From: [EMAIL PROTECTED]
Operating system: linux
PHP version: 5CVS-2006-02-16 (CVS)
PHP Bug Type: Strings related
Bug description: basename("gpg") has valgrind errors
Description:
------------
basename("gpg") has valgrind errors, and for some reason uses mblen()...
Reproduce code:
---------------
valgrind --num-callers=24 php -r 'echo basename("gpg");'
Actual result:
--------------
==27568== Invalid read of size 4
==27568== at 0x4010FE7: (within /lib/ld-2.3.5.so)
==27568== by 0x400AFA9: (within /lib/ld-2.3.5.so)
==27568== by 0x4007DBD: (within /lib/ld-2.3.5.so)
==27568== by 0x45F3A6B: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x400B056: (within /lib/ld-2.3.5.so)
==27568== by 0x45F3BED: __libc_dlsym (in /lib/tls/libc-2.3.5.so)
==27568== by 0x450B54D: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x450ABD8: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x450B0E8: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x45037E0: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x456C538: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x4560DE5: mbrtowc (in /lib/tls/libc-2.3.5.so)
==27568== by 0x4518900: mblen (in /lib/tls/libc-2.3.5.so)
==27568== by 0x8300751: php_basename (string.c:1132)
==27568== by 0x8300921: zif_basename (string.c:1200)
==27568== by 0x83BE29C: execute_internal (zend_execute.c:1368)
==27568== by 0x497B40E: xdebug_execute_internal (xdebug.c:1375)
==27568== by 0x83BE83D: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:194)
==27568== by 0x83C3A33: ZEND_DO_FCALL_SPEC_CONST_HANDLER
(zend_vm_execute.h:1587)
==27568== by 0x83BE470: execute (zend_vm_execute.h:92)
==27568== by 0x497B0AA: xdebug_execute (xdebug.c:1313)
==27568== by 0x8394678: zend_eval_string (zend_execute_API.c:1091)
==27568== by 0x83947CA: zend_eval_string_ex (zend_execute_API.c:1125)
==27568== by 0x840F3DA: main (php_cli.c:1129)
==27568== Address 0x4B08A9C is 28 bytes inside a block of size 29
alloc'd
==27568== at 0x401B41A: malloc (vg_replace_malloc.c:149)
==27568== by 0x4003D27: (within /lib/ld-2.3.5.so)
==27568== by 0x40064DA: (within /lib/ld-2.3.5.so)
==27568== by 0x45F1B2F: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x400B056: (within /lib/ld-2.3.5.so)
==27568== by 0x45F24EA: _dl_open (in /lib/tls/libc-2.3.5.so)
==27568== by 0x45F39FC: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x400B056: (within /lib/ld-2.3.5.so)
==27568== by 0x45F3B5D: __libc_dlopen_mode (in /lib/tls/libc-2.3.5.so)
==27568== by 0x450B4FA: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x450ABD8: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x450B0E8: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x45037E0: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x456C538: (within /lib/tls/libc-2.3.5.so)
==27568== by 0x4560DE5: mbrtowc (in /lib/tls/libc-2.3.5.so)
==27568== by 0x4518900: mblen (in /lib/tls/libc-2.3.5.so)
==27568== by 0x8300751: php_basename (string.c:1132)
==27568== by 0x8300921: zif_basename (string.c:1200)
==27568== by 0x83BE29C: execute_internal (zend_execute.c:1368)
==27568== by 0x497B40E: xdebug_execute_internal (xdebug.c:1375)
==27568== by 0x83BE83D: zend_do_fcall_common_helper_SPEC
(zend_vm_execute.h:194)
==27568== by 0x83C3A33: ZEND_DO_FCALL_SPEC_CONST_HANDLER
(zend_vm_execute.h:1587)
==27568== by 0x83BE470: execute (zend_vm_execute.h:92)
==27568== by 0x497B0AA: xdebug_execute (xdebug.c:1313)
(turning off xdebug doesn't make a difference)
--
Edit bug report at http://bugs.php.net/?id=36412&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36412&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36412&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36412&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36412&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36412&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36412&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36412&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36412&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36412&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36412&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36412&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36412&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36412&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36412&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36412&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36412&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36412&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36412&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36412&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36412&r=mysqlcfg