pecl-mail-mailparse icon indicating copy to clipboard operation
pecl-mail-mailparse copied to clipboard

Segmentation fault mailparse 3.1.9

Open eXorus opened this issue 2 months ago • 3 comments

Hi, I’m the maintainer of php-mime-mail-parser, which depends on mailparse. When running our full test suite under PHP 8.5 with mailparse 3.1.9, all tests pass but PHP crashes immediately after PHPUnit finishes.

Details:

  • PHP 8.0–8.4 work fine with earlier mailparse versions.
  • The crash only occurs on PHP 8.5 with mailparse 3.1.9.
  • PHPUnit 9.6.29 is used.

Here is the issue: https://github.com/php-mime-mail-parser/php-mime-mail-parser/actions/runs/19296608895/job/55180068007?pr=473

PHPUnit 9.6.22 by Sebastian Bergmann and contributors.

...............................................................  63 / 159 ( 39%)
............................................................... 126 / 159 ( 79%)
.................................                               159 / 159 (100%)

Time: 00:00.516, Memory: 31.12 MB

OK (159 tests, 1915 assertions)
/home/runner/work/_temp/6157c364-f825-41de-9817-34a9b5a077e6.sh: line 1:  5366 Segmentation fault      (core dumped) vendor/bin/phpunit
Error: Process completed with exit code 139.

Thanks for looking into this — I’m happy to provide more details or help debug if needed.

eXorus avatar Nov 12 '25 12:11 eXorus

Minimal reproducer + gdb backtrace will be hepful

remicollet avatar Nov 12 '25 13:11 remicollet

Can reproduce with 3.1.9 with all PHP versions

(gdb) bt
#0  _zend_hash_get_valid_pos (ht=0x7fffc19e2698, pos=0) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend_types.h:648
#1  zend_hash_internal_pointer_reset_ex (ht=ht@entry=0x7fffc19e2698, pos=pos@entry=0x7fffffffb314) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend_hash.c:2748
#2  0x00007fffda9edae4 in php_mimepart_free (part=0x7fffc19e2680) at /usr/src/debug/php-pecl-mailparse-3.1.9-1.fc41.remi.8.3.x86_64/mailparse-3.1.9/php_mailparse_mime.c:325
#3  0x00005555557a315b in zend_resource_dtor (res=<optimized out>) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend_list.c:73
#4  0x00005555557a3770 in zend_close_rsrc_list (ht=0x555555a2b8f8 <executor_globals+568>) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend_list.c:225
#5  0x000055555577841e in zend_shutdown_executor_values (fast_shutdown=fast_shutdown@entry=true) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend_execute_API.c:278
#6  0x0000555555778520 in shutdown_executor () at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend_execute_API.c:417
#7  0x000055555578a977 in zend_deactivate () at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/Zend/zend.c:1296
#8  0x00005555557178cb in php_request_shutdown (dummy=dummy@entry=0x0) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/main/main.c:1912
#9  0x0000555555880ce0 in do_cli (argc=argc@entry=2, argv=argv@entry=0x555555a34150) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/sapi/cli/php_cli.c:1137
#10 0x000055555559f3a2 in main (argc=2, argv=0x555555a34150) at /usr/src/debug/php-8.3.27-1.module_php.8.3.fc41.remi.x86_64/sapi/cli/php_cli.c:1341

remicollet avatar Nov 12 '25 14:11 remicollet

So related to f4c9d92c90c7bfdfc8b3bfe41ff5b18091783f1d :(

remicollet avatar Nov 12 '25 14:11 remicollet