Bug #74577 [NEW]: Memory corruption in zend_string_extend

From: Date: Fri, 12 May 2017 06:33:06 +0000
Subject: Bug #74577 [NEW]: Memory corruption in zend_string_extend
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209081@lists.php.net to get a copy of this message
From: whitehat002 at hotmail dot com Operating system: PHP version: 7.1.5 Package: Reproducible crash Bug Type: Bug Bug description:Memory corruption in zend_string_extend Description: ------------ This bug only exists in php7.This can result in denial of service or other problem. Test script: --------------- <?php ini_set('memory_limit',-1); $a=str_repeat("a",0x7ffffe00); $a.=$a; Expected result: ---------------- no crash Actual result: -------------- [----------------------------------registers-----------------------------------] EAX: 0xfffffc00 EBX: 0xb7013050 --> 0x36c00000 ECX: 0x80000000 EDX: 0x36c00010 ESI: 0xb7013050 --> 0x36c00000 EDI: 0x36c00000 EBP: 0x7ffffe00 ESP: 0xbfffc080 --> 0x0 EIP: 0x83b7b09 (<concat_function+393>: mov DWORD PTR [edi+0x8],0x0) EFLAGS: 0x210286 (carry PARITY adjust zero SIGN trap INTERRUPT direction overflow) [-------------------------------------code-------------------------------------] 0x83b7b00 <concat_function+384>: mov edi,eax 0x83b7b02 <concat_function+386>: mov eax,DWORD PTR [esp+0x18] 0x83b7b06 <concat_function+390>: lea edx,[edi+0x10] => 0x83b7b09 <concat_function+393>: mov DWORD PTR [edi+0x8],0x0 0x83b7b10 <concat_function+400>: mov DWORD PTR [esp+0x2c],edx 0x83b7b14 <concat_function+404>: mov DWORD PTR [edi+0xc],eax 0x83b7b17 <concat_function+407>: jmp 0x83b7a56 <concat_function+214> 0x83b7b1c <concat_function+412>: mov ecx,DWORD PTR [esp+0x20] [------------------------------------stack-------------------------------------] 0000| 0xbfffc080 --> 0x0 0004| 0xbfffc084 --> 0x5 0008| 0xbfffc088 --> 0xbfffc1a8 --> 0x1 0012| 0xbfffc08c --> 0xbfffc110 --> 0xb70543f0 --> 0xb70543d8 --> 0xb70543a8 --> 0xb7054420 (--> ...) 0016| 0xbfffc090 --> 0xb705e320 --> 0x0 0020| 0xbfffc094 --> 0x7ffffe00 0024| 0xbfffc098 --> 0xfffffc00 0028| 0xbfffc09c --> 0xb7013050 --> 0x36c00000 [------------------------------------------------------------------------------] Legend: code, data, rodata, value Stopped reason: SIGSEGV zend_string_extend (persistent=0x0, len=0xfffffc00, s=0x36c00000) at /root/php-7.1.5/Zend/zend_string.h:210 210 zend_string_forget_hash_val(ret); gdb-peda$ bt #0 zend_string_extend (persistent=0x0, len=0xfffffc00, s=0x36c00000) at /root/php-7.1.5/Zend/zend_string.h:210 #1 concat_function (result=0xb7013050, op1=0xb7013050, op2=0xb7013050) at /root/php-7.1.5/Zend/zend_operators.c:1759 #2 0x08439dba in zend_binary_assign_op_helper_SPEC_CV_CV ( binary_op=0x83b7980 <concat_function>, execute_data=0xb7013020) at /root/php-7.1.5/Zend/zend_vm_execute.h:44196 #3 0x0840969e in execute_ex (ex=0xb7013020) at /root/php-7.1.5/Zend/zend_vm_execute.h:432 #4 0x08457abf in zend_execute (op_array=0xb7069180, return_value=0x0) at /root/php-7.1.5/Zend/zend_vm_execute.h:474 #5 0x083c1890 in zend_execute_scripts (type=0x8, retval=0x0, file_count=0x3) at /root/php-7.1.5/Zend/zend.c:1476 #6 0x08362cad in php_execute_script (primary_file=0xbfffe464) at /root/php-7.1.5/main/main.c:2537 #7 0x08459bd4 in do_cli (argc=0x3, argv=0x8a8e868) at /root/php-7.1.5/sapi/cli/php_cli.c:993 #8 0x080785ad in main (argc=0x3, argv=0x8a8e868) at /root/php-7.1.5/sapi/cli/php_cli.c:1381 #9 0xb791daf3 in __libc_start_m -- Edit bug report at https://bugs.php.net/bug.php?id=74577&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74577&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74577&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74577&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74577&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74577&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74577&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74577&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74577&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74577&r=support Expected behavior: https://bugs.php.net/fix.php?id=74577&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74577&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74577&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74577&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74577&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74577&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74577&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74577&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74577&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74577&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74577&r=mysqlcfg

« previous php.bugs (#209081) next »