Bug #78456 [NEW]: Segfault when unserializing iterator
| From: | edgaras dot janusauskas at gmail dot com | Date: | Sun, 25 Aug 2019 20:10:20 +0000 |
| Subject: | Bug #78456 [NEW]: Segfault when unserializing iterator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222409@lists.php.net to get a copy of this message | ||
From: edgaras dot janusauskas at gmail dot com
Operating system: Windows, Ubuntu
PHP version: 7.4.0beta4
Package: Reproducible crash
Bug Type: Bug
Bug description:Segfault when unserializing iterator
Description:
------------
PHP 7.4 crashes while running CakePHP test suite on Travis CI.
PHP 7.3 and below is OK.
It crashes in test while unserializing class which extends
IteratorIterator and implements Serializable, and also uses
SplDoublyLinkedList.
https://github.com/cakephp/cakephp/blob/3.8.2/tests/TestCase/Collection/CollectionTest.php#L2383-L2390
I've tried to reduce test to short vanilla PHP script, I were not able.
Install cakephp/collection:3.8.2 via composer.
Test script:
---------------
composer require cakephp/collection
require 'vendor/autoload.php';
$collection = new \Cake\Collection\Collection([1, 2, 3]);
$serialized = serialize($collection);
$unserialized = unserialize($serialized); // crash
Expected result:
----------------
Object is unserialized successfully.
Actual result:
--------------
Backtrace when running on PHP 7.4.0beta4 (cli) (built: Aug 21 2019
08:53:45) ( NTS Visual C++ 2017 x64 ):
Access violation - code c0000005 (first chance)
00 php7!zend_mm_alloc_small
01 php7!zend_mm_alloc_heap
02 php7!_emalloc
03 php7!_zend_new_array
04 php7!php_var_unserialize_internal
05 php7!process_nested_data
06 php7!php_var_unserialize_internal
07 php7!process_nested_data
08 php7!object_common
09 php7!php_var_unserialize_internal
0a php7!php_var_unserialize
0b php7!zif_unserialize
0c php7!ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_HANDLER
0d php7!execute_ex
0e php7!zend_call_function
0f php7!zend_call_method
10 php7!zend_user_unserialize
11 php7!object_custom
12 php7!php_var_unserialize_internal
13 php7!php_var_unserialize
14 php7!zif_unserialize
15 php7!ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_HANDLER
16 php7!execute_ex
17 php7!zend_call_function
18 php7!zend_call_method
19 php7!zend_user_unserialize
1a php7!object_custom
1b php7!php_var_unserialize_internal
1c php7!php_var_unserialize
1d php7!zif_unserialize
1e php7!ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER
1f php7!execute_ex
20 php7!zend_execute
21 php7!zend_execute_scripts
22 php7!php_execute_script
23 php!sapi_cli_single_write
24 php!sapi_cli_single_write
25 php!sapi_cli_single_write
26 KERNEL32!BaseThreadInitThunk
27 ntdll!RtlUserThreadStart
--
Edit bug report at https://bugs.php.net/bug.php?id=78456&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78456&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78456&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78456&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78456&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78456&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78456&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78456&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78456&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78456&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78456&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78456&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78456&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78456&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78456&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78456&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78456&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78456&r=mysqlcfg