php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60194 --with-zend-multibyte and --enable-debug reports LEAK with run-test.php
Submitted: 2011-11-01 18:54 UTC Modified: 2012-07-30 11:02 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: yohgaki at ohgaki dot net Assigned: laruence (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.3SVN-2011-11-01 (SVN) OS: Linux
Private report: No CVE-ID: None
 [2011-11-01 18:54 UTC] yohgaki at ohgaki dot net
Description:
------------
PHP 5.3 trunk reports LEAKS with --enable-zend-multibyte and --enable-debug with 
valgrind 3.6.1. I also tested rather old 5.3.5 and got the same result. Trunk 
(php-src) seems fine.


php-src-5.3]$ cat config.nice 
#! /bin/sh
#
# Created by configure

'./configure' \
'--prefix=/usr/local/php5.3' \
'--without-pear' \
'--enable-zend-multibyte' \
'--enable-debug' \
"$@"


php-src-5.3]$ TEST_PHP_EXECUTABLE=./sapi/cli/php ./run-tests.php -m -n

=====================================================================
PHP         : ./sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.9-dev
ZEND_VERSION: 2.3.0
PHP_OS      : Linux - Linux dev.inter.es-i.jp 2.6.35.14-2m.mo7.x86_64 #1 SMP Mon 
Sep 12 11:09:50 JST 2011 x86_64
INI actual  : /home/yohgaki/ext/svn/oss/php.net/php-src-5.3
More .INIs  :  
CWD         : /home/yohgaki/ext/svn/oss/php.net/php-src-5.3
Extra dirs  : 
VALGRIND    : valgrind-3.6.1
=====================================================================
TIME START 2011-11-02 03:39:09
=====================================================================
LEAK EXPECT [tests/run-test/test001.phpt] 
LEAK EXPECTF [tests/run-test/test002.phpt] 
LEAK EXPECTREGEX [tests/run-test/test003.phpt] 
LEAK INI section allows '=' [tests/run-test/test004.phpt] 
LEAK Error message handling (without ZendOptimizer) [tests/run-
test/test005.phpt] 
LEAK Error messages are shown [tests/run-test/test006.phpt] 
(CTRL-Ced, many test reports LEAK but not all of them)

php-src-5.3]$ cat tests/run-test/test001.mem 
==12385== Invalid read of size 1
==12385==    at 0x7A429F: lex_scan (zend_language_scanner.c:1026)
==12385==    by 0x7D12D9: zendlex (zend_compile.c:4969)
==12385==    by 0x79C62C: zendparse (zend_language_parser.c:3299)
==12385==    by 0x7A2AB4: compile_file (zend_language_scanner.l:364)
==12385==    by 0x5F9983: phar_compile_file (phar.c:3391)
==12385==    by 0x7E7121: zend_execute_scripts (zend.c:1228)
==12385==    by 0x76E731: php_execute_script (main.c:2301)
==12385==    by 0x8D2F5F: main (php_cli.c:1184)
==12385==  Address 0x5052f65 is 0 bytes after a block of size 5 alloc'd
==12385==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==12385==    by 0x7C1501: _emalloc (zend_alloc.c:2348)
==12385==    by 0x7A2809: open_file_for_scanning (zend_language_scanner.l:288)
==12385==    by 0x7A2A32: compile_file (zend_language_scanner.l:352)
==12385==    by 0x5F9983: phar_compile_file (phar.c:3391)
==12385==    by 0x7E7121: zend_execute_scripts (zend.c:1228)
==12385==    by 0x76E731: php_execute_script (main.c:2301)
==12385==    by 0x8D2F5F: main (php_cli.c:1184)
==12385==



Test script:
---------------
N/A

Expected result:
----------------
Tests should pass w/o LEAK.

Actual result:
--------------
It reports lots of LEAKs.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-02 12:05 UTC] johannes@php.net
-Status: Open +Status: Feedback
 [2011-11-02 12:05 UTC] johannes@php.net
I can't reproduce that. As this happens in lex_scan: Do you by chance have have re2c installed and are therefore running a different parser than what is committed in svn? anything else special on your system?
 [2011-11-02 23:07 UTC] yohgaki at ohgaki dot net
I have 

$ rpm -q re2c
re2c-0.13.5-2m.mo7.x86_64

It may be causing it. What version are you using?
 [2011-11-02 23:15 UTC] yohgaki at ohgaki dot net
BTW, I'm using rpm package but the spec is plain ./configure && make && make 
install. gcc is 

$ LC_ALL=C gcc -v
Using built-in specs.
Target: x86_64-momonga-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --with-bugurl=http://developer.momonga-
linux.org/kagemai/ --enable-bootstrap --enable-shared --enable-threads=posix --
enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-gnu-unique-object --enable-
languages=c,c++,objc,obj-c++,java,fortran --enable-java-awt=gtk --disable-dssi -
-with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-
multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-
ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic -
-with-arch_32=i686 --build=x86_64-momonga-linux
Thread model: posix
gcc version 4.4.4 20100630 (Momonga Linux 7 4.4.4-3m.mo7) (GCC)
 [2011-11-03 00:52 UTC] yohgaki at ohgaki dot net
-Status: Feedback +Status: Open
 [2011-11-03 00:52 UTC] yohgaki at ohgaki dot net
I svn diffed source. No diff. So I suppose it would be other reason.

I've mailed internals since I thought PHP 5.4 and trunk was ok, but it turns out 
it didn't enabled zend.multibyte. There may be the same issue with 
zend.multibyte=on (if it can)
 [2012-07-27 14:00 UTC] c dot kworr at gmail dot com
I'm getting the same on FreeBSD 9.0 and PHP 5.3.15:

[Fri Jul 27 13:15:16 2012]  Script:  '/home/zima/www/price/cron/filter.php'                                                              
/tmp/ports/.amd_mnt/faz/host/usr/ports/lang/php53/work/php-
5.3.15/ext/standard/base64.c(69) :  Freeing 0x81D7C35D0 (601 bytes), script=/$
/tmp/ports/.amd_mnt/faz/host/usr/ports/lang/php53/work/php-
5.3.15/Zend/zend_alloc.c(2734) : Actual location (location was relayed)
 [2012-07-27 16:05 UTC] laruence@php.net
-Status: Open +Status: Verified
 [2012-07-27 16:05 UTC] laruence@php.net
I can confirm,  but only on 5.3,  5.4 has no such issue
 [2012-07-27 16:49 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef7286a42f0d85cc359f1d64678f859d6c3f832e
Log: Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php)
 [2012-07-27 16:50 UTC] laruence@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-07-27 16:50 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-07-27 16:52 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef7286a42f0d85cc359f1d64678f859d6c3f832e
Log: Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php)
 [2012-07-27 16:53 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef7286a42f0d85cc359f1d64678f859d6c3f832e
Log: Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php)
 [2012-07-28 08:58 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b477a84026a39a58452af9676b4b74607e83e2f8
Log: Fixed bug #60194 for eavl
 [2012-07-28 08:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b477a84026a39a58452af9676b4b74607e83e2f8
Log: Fixed bug #60194 for eavl
 [2012-07-28 08:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b477a84026a39a58452af9676b4b74607e83e2f8
Log: Fixed bug #60194 for eavl
 [2012-07-30 10:45 UTC] c dot kworr at gmail dot com
Strange, but after applying a patch from http://git.php.net/?p=php-src.git;a=commit;h=ef7286a42f0d85cc359f1d64678f859d6c3f832e and rebuilding everything the bug still persists. Is this a full 
patch or a last commit to close the problem?

Still I don't know how to craft the test case but I'll try. Right now it gives me:

[Mon Jul 30 13:00:16 2012]  Script:  '/home/price-/www/price09.com.ua/cron/_cat.php'
/tmp/ports/usr/ports/lang/php53/work/php-5.3.15/ext/standard/base64.c(69) :  Freeing 0x8171B5598 (601 bytes), script=/home/price-/www/price09.com.ua/cron/_cat.php
/tmp/ports/usr/ports/lang/php53/work/php-5.3.15/Zend/zend_alloc.c(2734) : Actual location (location was relayed)
[Mon Jul 30 13:00:16 2012]  Script:  '/home/price-/www/price09.com.ua/cron/_cat.php'
/tmp/ports/usr/ports/databases/php53-redis/work/nicolasff-phpredis-250e81b/library.c(718) :  Freeing 0x80DA67F80 (10 bytes), script=/home/price-/www/price09.com.ua/cron/_cat.php
=== Total 2 memory leaks detected ===

The output was effectively the same as before the patch.
 [2012-07-30 11:02 UTC] laruence@php.net
@c.kworr the leak related to redis extension.
 [2014-10-07 23:23 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b477a84026a39a58452af9676b4b74607e83e2f8
Log: Fixed bug #60194 for eavl
 [2014-10-07 23:23 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=ef7286a42f0d85cc359f1d64678f859d6c3f832e
Log: Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php)
 [2014-10-07 23:34 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b477a84026a39a58452af9676b4b74607e83e2f8
Log: Fixed bug #60194 for eavl
 [2014-10-07 23:34 UTC] stas@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=ef7286a42f0d85cc359f1d64678f859d6c3f832e
Log: Fixed bug #60194 (--with-zend-multibyte and --enable-debug reports LEAK with run-test.php)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 16:01:33 2024 UTC