gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-dev] About SafeStack


From: strk
Subject: [Gnash-dev] About SafeStack
Date: Thu, 28 Aug 2008 03:35:00 +0200

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! 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]