(perl #131836) avoid a use-after-free after parsing a "sub" keyword
authorTony Cook <tony@develop-help.com>
Mon, 7 Aug 2017 01:27:50 +0000 (11:27 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 28 Aug 2017 06:05:47 +0000 (16:05 +1000)
commit3b8804a4c2320ae4e7e713c5836d340eb210b6cd
treefa0811bdc2ba2b27f4340bfbcca8d56d019a050b
parent43272d222fe12f33c708d42b2a71af36cc92e4bd
(perl #131836) avoid a use-after-free after parsing a "sub" keyword

The:

  d = skipspace(d);

can reallocate linestr in the test case, invalidating s.  This would
end up in PL_bufptr from the embedded (PL_bufptr = s) in the TOKEN()
macro.

Assigning s to PL_bufptr and restoring s from PL_bufptr allows
lex_next_chunk() to adjust the pointer to the reallocated buffer.
t/comp/parser_run.t
toke.c