php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69420 Invalid read in zend_std_get_method
Submitted: 2015-04-10 14:50 UTC Modified: 2015-04-10 14:53 UTC
From: laruence@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.5.23 OS:
Private report: No CVE-ID:
 [2015-04-10 14:50 UTC] laruence@php.net
Description:
------------
none

Test script:
---------------
<?php
trait T {
    protected function test() {}
}
 
class A {
    protected function test() {
    }
}
 
class B extends A {
    use T;
    public function foo() {
        $this->test();
    }
}
 
$b = new B();
$b->foo();

Expected result:
----------------
nothing with valgrind

Actual result:
--------------
==6262== Invalid read of size 8
==6262==    at 0x84CF2B: zend_std_get_method (zend_object_handlers.c:1103)
==6262==    by 0x86C9B4: ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER (zend_vm_execute.h:25480)
==6262==    by 0x85D207: execute_ex (zend_vm_execute.h:363)
==6262==    by 0x8243DF: zend_execute_scripts (zend.c:1341)
==6262==    by 0x7C2121: php_execute_script (main.c:2597)
==6262==    by 0x8C83EE: do_cli (php_cli.c:994)
==6262==    by 0x4415CF: main (php_cli.c:1378)
==6262==  Address 0xf7a3940 is 16 bytes inside a block of size 248 free'd
==6262==    at 0x4C2CE8E: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6262==    by 0x82FB0C: _zend_hash_quick_add_or_update (zend_hash.c:335)
==6262==    by 0x803D49: zend_add_trait_method (zend_compile.c:4088)
==6262==    by 0x804477: zend_traits_copy_functions (zend_compile.c:4187)
==6262==    by 0x830A07: zend_hash_apply_with_arguments (zend_hash.c:701)
==6262==    by 0x80754D: zend_do_bind_traits (zend_compile.c:4357)
==6262==    by 0x864E33: ZEND_BIND_TRAITS_SPEC_HANDLER (zend_vm_execute.h:1163)
==6262==    by 0x85D207: execute_ex (zend_vm_execute.h:363)
==6262==    by 0x8243DF: zend_execute_scripts (zend.c:1341)
==6262==    by 0x7C2121: php_execute_script (main.c:2597)
==6262==    by 0x8C83EE: do_cli (php_cli.c:994)
==6262==    by 0x4415CF: main (php_cli.c:1378)
==6262==

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-10 14:53 UTC] derick@php.net
This is also a problem in PHP 5.4 and 5.6.
 [2015-04-10 14:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=429f411eb39b1898a87efb0839f74f6e7c7d6ea1
Log: Fixed bug #69420 (Invalid read in zend_std_get_method)
 [2015-04-10 14:59 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-04-10 15:01 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=429f411eb39b1898a87efb0839f74f6e7c7d6ea1
Log: Fixed bug #69420 (Invalid read in zend_std_get_method)
 [2015-04-10 15:01 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=429f411eb39b1898a87efb0839f74f6e7c7d6ea1
Log: Fixed bug #69420 (Invalid read in zend_std_get_method)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Feb 19 14:01:37 2017 UTC