develooper Front page | perl.perl5.porters | Postings from January 2017

Re: [perl #126191] null ptr deref and segfault: Perl_pad_add_anon(pad.c:821) [perl 5.21.7]

Thread Next
January 27, 2017 08:07
Re: [perl #126191] null ptr deref and segfault: Perl_pad_add_anon(pad.c:821) [perl 5.21.7]
Message ID:
This bug is very sensitive to the details of the syntax errors.  In the
execution that leads up to the assertion failure, the second sub{} is
treated as being nested inside the first, and this is crucial to the
failure mode.  (Almost any edit to the test code leads to them being
treated as sequential, avoiding the assertion failure.)

The first newANONATTRSUB() call, for the second sub{}, succeeds.
The second newANONATTRSUB() call, for the first sub{}, then fails,
because it finds that PL_compcv is null.  PL_compcv becomes null as a
side effect of the first newANONATTRSUB() call, and in normal operation
the value that PL_compcv had in the surrounding scope would immediately be
restored, with the end of compilation of the nested sub{}.  Evidently the
restoration isn't happening.  This is obviously for reasons tied up with
the parser's error recovery, a pretty opaque part of the code.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About