php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61186 valgrind complain of invalid reading
Submitted: 2012-02-26 15:12 UTC Modified: 2015-08-28 11:37 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: laruence@php.net Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.10 OS:
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: laruence@php.net
New email:
PHP Version: OS:

 

 [2012-02-26 15:12 UTC] laruence@php.net
Description:
------------
while use valgrind exam PHP 5.3,  it complain of invalid reading.


Test script:
---------------
<?php
echo 2;
?>

#run 
$USE_ZEND_ALLOC=0 valgrind php53 above.php

Expected result:
----------------
no complaint

Actual result:
--------------
==11759== Memcheck, a memory error detector
==11759== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==11759== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==11759== Command: php above.php
==11759== 
==11759== Invalid read of size 1
==11759==    at 0x8F4D95: lex_scan (zend_language_scanner.c:1028)
==11759==    by 0x932C91: zendlex (zend_compile.c:4975)
==11759==    by 0x8EA7E3: zendparse (zend_language_parser.c:2948)
==11759==    by 0x8F240B: compile_file (zend_language_scanner.l:364)
==11759==    by 0x6CA931: phar_compile_file (phar.c:3393)
==11759==    by 0x94DD0E: zend_execute_scripts (zend.c:1228)
==11759==    by 0x8B5E33: php_execute_script (main.c:2308)
==11759==    by 0xA430C4: main (php_cli.c:1184)
==11759==  Address 0x87ec132 is 0 bytes after a block of size 18 alloc'd
==11759==    at 0x490514E: malloc (vg_replace_malloc.c:195)
==11759==    by 0x91DC2D: _emalloc (zend_alloc.c:2348)
==11759==    by 0x8F1E36: open_file_for_scanning (zend_language_scanner.l:288)
==11759==    by 0x8F2343: compile_file (zend_language_scanner.l:352)
==11759==    by 0x6CA931: phar_compile_file (phar.c:3393)
==11759==    by 0x94DD0E: zend_execute_scripts (zend.c:1228)
==11759==    by 0x8B5E33: php_execute_script (main.c:2308)
==11759==    by 0xA430C4: main (php_cli.c:1184)
==11759== 
2==11759== 
==11759== HEAP SUMMARY:
==11759==     in use at exit: 46,688 bytes in 1,586 blocks
==11759==   total heap usage: 29,304 allocs, 27,718 frees, 4,549,300 bytes 
allocated
==11759== 
==11759== LEAK SUMMARY:
==11759==    definitely lost: 0 bytes in 0 blocks
==11759==    indirectly lost: 0 bytes in 0 blocks
==11759==      possibly lost: 0 bytes in 0 blocks
==11759==    still reachable: 46,688 bytes in 1,586 blocks
==11759==         suppressed: 0 bytes in 0 blocks
==11759== Rerun with --leak-check=full to see details of leaked memory
==11759== 
==11759== For counts of detected and suppressed errors, rerun with: -v
==11759== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-26 15:28 UTC] rasmus@php.net
Not seeing that here on my 5.3.10 build:

3:26pm x220:~/php-5.3.10> memcheck sapi/cli/php test.php
==32664== Memcheck, a memory error detector
==32664== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==32664== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright 
info
==32664== Command: sapi/cli/php test.php
==32664== 
2==32664== 
==32664== HEAP SUMMARY:
==32664==     in use at exit: 1,016 bytes in 7 blocks
==32664==   total heap usage: 25,722 allocs, 25,715 frees, 3,633,436 bytes 
allocated
==32664== 
==32664== LEAK SUMMARY:
==32664==    definitely lost: 0 bytes in 0 blocks
==32664==    indirectly lost: 0 bytes in 0 blocks
==32664==      possibly lost: 0 bytes in 0 blocks
==32664==    still reachable: 0 bytes in 0 blocks
==32664==         suppressed: 1,016 bytes in 7 blocks
==32664== 
==32664== For counts of detected and suppressed errors, rerun with: -v
==32664== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 6)

My memcheck script is:

#!/bin/bash
USE_ZEND_ALLOC=0 valgrind --tool=memcheck --
suppressions=/home/rasmus/.suppressions --leak-check=yes --track-origins=yes --
num-callers=30 --show-reachable=yes "$@"

And I am not suppressing that one obviously.
 [2012-02-26 15:42 UTC] laruence@php.net
try after enable multi-byte support, thanks
 [2012-02-26 15:53 UTC] rasmus@php.net
Still clean for me with --enable-zend-multibyte
Please provide the minimum set of configure flags you can reproduce this with.
 [2012-02-26 19:38 UTC] phpmpan at mpan dot pl
./configure --with-readline --enable-debug --enable-zend-multibyte

Happens for snapshot (2012/02/26 18:30) of 5.3, but *does not* happen on snapshot of trunk.
 [2012-02-26 21:08 UTC] rasmus@php.net
Ok, verified. It only happens with --enable-debug
 [2012-02-27 08:53 UTC] laruence@php.net
-Status: Open +Status: Verified
 [2015-08-28 11:37 UTC] nikic@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nikic
 [2015-08-28 11:37 UTC] nikic@php.net
Multibyte assertion failures and invalid memory reads were fixed in PHP 7 -- probably covering whatever this was as well.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 19:01:29 2024 UTC