php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36412 basename("gpg") has valgrind errors
Submitted: 2006-02-16 10:36 UTC Modified: 2007-07-09 13:05 UTC
From: derick@php.net Assigned: derick (profile)
Status: Not a bug Package: Strings related
PHP Version: 5CVS-2006-02-16 (CVS) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: derick@php.net
New email:
PHP Version: OS:

 

 [2006-02-16 10:36 UTC] derick@php.net
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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-16 11:50 UTC] tony2001@php.net
Just for the record: not reproducible on machines I have around here (glibc 2.3.2/2.3.3/2.3.4). 
Seems like glibc (or glibc-related) issue.
 [2007-07-09 13:05 UTC] derick@php.net
Can't reproduce this myself anymore now either.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC