Background: http://savannah.gnu.org/bugs/index.php?23489

Finally got a feel of why we'd need a "safe" stack.
Keeping references of values on a stack that reallocates
can result in wild pointers in case of reallocation.

It's incredible how few such cases we found so far and
I'm glad Benjamin found a case for inspection.

Basically, any as_value& obtained from as_environment
::top() or ::bottom() is a weapon everytime it's used
after a call to ::push() as the ::push() might trigger
reallocation thus leaving old references pointing
to arbitrary memory.

So SafeStack (part of Chad's AVM2 work) never reallocates.
Instead it allocate chunks of consecutive memory and 
never deallocate them until the whole stack is destroyed.

I plan to change as_environment to use SafeStack for a start. 

--strk; 

 ()   ASCII Ribbon Campaign
 /\   Keep it simple! 



_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to