Bug #66987 [NEW]: Memory corruption in fileinfo ext (bigendian)
| From: | remi@php.net | Date: | Mon, 31 Mar 2014 13:15:03 +0000 |
| Subject: | Bug #66987 [NEW]: Memory corruption in fileinfo ext (bigendian) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-184980@lists.php.net to get a copy of this message | ||
From: remi
Operating system: GNU/LInux (bugendian)
PHP version: 5.4.26
Package: Filesystem function related
Bug Type: Bug
Bug description:Memory corruption in fileinfo ext (bigendian)
Description:
------------
Discovered running fileinfo test on ppc64 ans s390x (both bigendian)
# export USE_ZEND_ALLOC=0 && valgrind php -n -d extension=fileinfo.so
test2.php
==26726== Memcheck, a memory error detector
==26726== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et
al.
==26726== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright
info
==26726== Command: php -n -d extension=fileinfo.so test2.php
==26726==
PE Unknown PE signature 0x0 (Unknown subsystem 0x0) Intel 80386 system
file, for MS Windows==26726== Invalid free() / delete / delete[] /
realloc()
==26726== at 0x482F972: free (in
/usr/lib64/valgrind/vgpreload_memcheck-s390x-linux.so)
==26726== by 0xBD8F7EB: apprentice_unmap (apprentice.c:499)
==26726== by 0xBD8F875: mlist_free (apprentice.c:530)
==26726== by 0xBD90939: file_ms_free (apprentice.c:444)
==26726== by 0xBD8E905: finfo_resource_destructor (fileinfo.c:194)
==26726== by 0x3A5C9F: list_entry_destructor (zend_list.c:183)
==26726== by 0x3A35F3: zend_hash_del_key_or_index (zend_hash.c:531)
==26726== by 0x3A5F3D: _zend_list_delete (zend_list.c:57)
==26726== by 0x384A41: _zval_ptr_dtor (zend_variables.h:35)
==26726== by 0x3A1EC9: zend_hash_apply_deleter (zend_hash.c:650)
==26726== by 0x3A3953: zend_hash_graceful_reverse_destroy
(zend_hash.c:687)
==26726== by 0x38518F: shutdown_executor (zend_execute_API.c:247)
==26726== Address 0xc024138 is 248 bytes inside a block of size
2,606,480 alloc'd
==26726== at 0x482E55A: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-s390x-linux.so)
==26726== by 0xBD93F4F: apprentice_1 (apprentice.c:2687)
==26726== by 0xBD8EB31: zif_finfo_open (fileinfo.c:345)
==26726== by 0x44D493: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:643)
==26726== by 0x3BFB6B: execute (zend_vm_execute.h:410)
==26726== by 0x395FA1: zend_execute_scripts (zend.c:1315)
==26726== by 0x330065: php_execute_script (main.c:2494)
==26726== by 0x44F64B: do_cli (php_cli.c:988)
==26726==
==26726== Invalid free() / delete / delete[] / realloc()
==26726== at 0x482F972: free (in
/usr/lib64/valgrind/vgpreload_memcheck-s390x-linux.so)
==26726== by 0xBD8F801: apprentice_unmap (apprentice.c:499)
==26726== by 0xBD8F875: mlist_free (apprentice.c:530)
==26726== by 0xBD90939: file_ms_free (apprentice.c:444)
==26726== by 0xBD8E905: finfo_resource_destructor (fileinfo.c:194)
==26726== by 0x3A5C9F: list_entry_destructor (zend_list.c:183)
==26726== by 0x3A35F3: zend_hash_del_key_or_index (zend_hash.c:531)
==26726== by 0x3A5F3D: _zend_list_delete (zend_list.c:57)
==26726== by 0x384A41: _zval_ptr_dtor (zend_variables.h:35)
==26726== by 0x3A1EC9: zend_hash_apply_deleter (zend_hash.c:650)
==26726== by 0x3A3953: zend_hash_graceful_reverse_destroy
(zend_hash.c:687)
==26726== by 0x38518F: shutdown_executor (zend_execute_API.c:247)
==26726== Address 0xc27b6e0 is 2,455,200 bytes inside a block of size
2,606,480 alloc'd
==26726== at 0x482E55A: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-s390x-linux.so)
==26726== by 0xBD93F4F: apprentice_1 (apprentice.c:2687)
==26726== by 0xBD8EB31: zif_finfo_open (fileinfo.c:345)
==26726== by 0x44D493: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:643)
==26726== by 0x3BFB6B: execute (zend_vm_execute.h:410)
==26726== by 0x395FA1: zend_execute_scripts (zend.c:1315)
==26726== by 0x330065: php_execute_script (main.c:2494)
==26726== by 0x44F64B: do_cli (php_cli.c:988)
==26726==
==26726==
==26726== HEAP SUMMARY:
==26726== in use at exit: 203,543 bytes in 2,869 blocks
==26726== total heap usage: 15,757 allocs, 12,890 frees, 5,922,519
bytes allocated
==26726==
==26726== LEAK SUMMARY:
==26726== definitely lost: 0 bytes in 0 blocks
==26726== indirectly lost: 0 bytes in 0 blocks
==26726== possibly lost: 0 bytes in 0 blocks
==26726== still reachable: 203,543 bytes in 2,869 blocks
==26726== suppressed: 0 bytes in 0 blocks
==26726== Rerun with --leak-check=full to see details of leaked memory
==26726==
==26726== For counts of detected and suppressed errors, rerun with: -v
==26726== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 2 from 2)
--
Edit bug report at https://bugs.php.net/bug.php?id=66987&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66987&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66987&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66987&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66987&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66987&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66987&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66987&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66987&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66987&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66987&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66987&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66987&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66987&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66987&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66987&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66987&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66987&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66987&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66987&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66987&r=mysqlcfg