develooper Front page | perl.perl5.porters | Postings from April 2010

Make POPEVAL() pop cx->blk_eval.old_namesv into a newsv local variable

Thread Next
From:
Vincent Pit
Date:
April 15, 2010 08:51
Subject:
Make POPEVAL() pop cx->blk_eval.old_namesv into a newsv local variable
Message ID:
4BC735F4.1040903@profvince.com
There are a few places in the core where the cx->blk_eval.old_namesv 
member is read after LEAVE happens. This is bad because LEAVE can call 
arbitrary code ; in particular, it can call a destructor that does 
call_sv(cv, G_EVAL), in which case the old eval context cx gets 
overwritten by the new one and cx->blk_eval.old_namesv points to garbage.

The attached patch fixes this issue by making POPEVAL() pop 
cx->blk_eval.old_namesv to a local variable "namesv". It can fix obscure 
"panic: restartop" or "Unknown errors" bugs, though it's hard to think 
of a pure-Perl regression test for it.

It's not suitable for 5.12.1 because the POPEVAL() public macro is 
changed in such a way third-party extensions that use it need to declare 
the new "namesv" variable.

Vincent.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About