Re: Re: PHP 5.6 static access valgrind issue
| From: | Nikita Popov | Date: | Wed, 09 Nov 2016 16:12:40 +0000 |
| Subject: | Re: Re: PHP 5.6 static access valgrind issue | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96790@lists.php.net to get a copy of this message | ||
On Wed, Nov 9, 2016 at 4:09 PM, Derick Rethans <derick@php.net> wrote:
> On Wed, 9 Nov 2016, Christoph M. Becker wrote:
>
> > On 09.11.2016 at 15:21, Derick Rethans wrote:
>
> <snip>
>
> > > And running it with "valgrind php -n index.php", produces:
> > >
> > > root@debian-8-64bit:/home/derick/xdebug-issue-1185# valgrind php
> -n index.php
> > > ==760== Memcheck, a memory error detector
> > > ==760== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward
> et al.
> > > ==760== Using Valgrind-3.10.0 and LibVEX; rerun with -h for
> copyright info
> > > ==760== Command: php -n index.php
> > > ==760==
> > > ==760== Conditional jump or move depends on uninitialised value(s)
> > > ==760== at 0x797992: zend_std_get_static_method
> (zend_object_handlers.c:1261)
> > > ==760== by 0x7B66FE: ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER
> (zend_vm_execute.h:3887)
> > > ==760== by 0x7A379F: execute_ex (zend_vm_execute.h:363)
> > > ==760== by 0x76E2AF: zend_execute_scripts (zend.c:1341)
> > > ==760== by 0x70CC87: php_execute_script (main.c:2613)
> > > ==760== by 0x81A990: do_cli (php_cli.c:998)
> > > ==760== by 0x431996: main (php_cli.c:1382)
> > > ==760==
>
> > zend_std_get_static_method() declares use_heap[1] (if there's support
> > for alloca), but doesn't initialize it with SET_ALLOCA_FLAG()[2]. It
> > seems to me that ALLOCA_FLAG()[3] should be defined like so:
> >
> > # define ALLOCA_FLAG(name) \
> > zend_bool name = 0;
>
> That sounds about right - Dmitry, Nikita?
>
This shouldn't be a problem. alloca is only used in the !key branches, in
which case the flag is initialized by do_alloca.
>
> > > I'm going to see whether PHP 7.0 and 7.1 have a similar issue too.
>
> It seems like there is a similar issue in PHP 7.0 and 7.1 too, looking
> at the source.
>
> cheers,
> Derick
>