gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/vm/ActionExec.cpp server...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/vm/ActionExec.cpp server...
Date: Fri, 10 Aug 2007 15:17:45 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/08/10 15:17:45

Modified files:
        .              : ChangeLog 
        server/vm      : ActionExec.cpp ActionExec.h 

Log message:
                * server/vm/ActionExec.{cpp,h}: refactor the check for call 
stack
                  depth at end of execution to take depth at *start* of 
execution
                  into account.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3985&r2=1.3986
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3985
retrieving revision 1.3986
diff -u -b -r1.3985 -r1.3986
--- ChangeLog   10 Aug 2007 14:24:56 -0000      1.3985
+++ ChangeLog   10 Aug 2007 15:17:44 -0000      1.3986
@@ -1,5 +1,11 @@
 2007-08-10 Sandro Santilli <address@hidden>
 
+       * server/vm/ActionExec.{cpp,h}: refactor the check for call stack
+         depth at end of execution to take depth at *start* of execution
+         into account.
+
+2007-08-10 Sandro Santilli <address@hidden>
+
        * server/vm/ActionExec.cpp (cleanupAfterRun): don't assume the call
          stack should be empty at the end of global code execution. Still
          print an error as we need further investigation about it. Fixes

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/vm/ActionExec.cpp    10 Aug 2007 14:24:57 -0000      1.40
+++ server/vm/ActionExec.cpp    10 Aug 2007 15:17:44 -0000      1.41
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: ActionExec.cpp,v 1.40 2007/08/10 14:24:57 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.41 2007/08/10 15:17:44 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -145,6 +145,8 @@
 
     _initial_stack_size = env.stack_size();
 
+    _initialCallStackDepth = env.callStackDepth();
+
 #if DEBUG_STACK
        IF_VERBOSE_ACTION (
                log_action(_("at ActionExec operator() start, pc=" SIZET_FMT
@@ -284,19 +286,32 @@
     env.set_target(_original_target);
     _original_target = NULL;
 
-    // check the call stack if not in a function context
-    if ( ! isFunction() && env.callStackDepth() > 0 )
+    // Check the call stack depth to be the same as the one we started with
+    // TODO: should this check be switched off based on GNASH_TRUST_SWF_INPUT ?
+    size_t currCallStackDepth = env.callStackDepth();
+    if ( currCallStackDepth != _initialCallStackDepth )
+    {
+       if ( currCallStackDepth > _initialCallStackDepth )
+       {
+               // TODO: try to produce this error hitting script limits
+               log_error(_("Call stack at end of ActionScript execution "
+                       "(" SIZET_FMT ") exceeds call stack depth at start "
+                       "of it (" SIZET_FMT ") - limits hit ?"),
+                        currCallStackDepth, _initialCallStackDepth);
+               size_t diff = currCallStackDepth-_initialCallStackDepth;
+               while (diff--)
+               {
+                       env.popCallFrame();
+               }
+       }
+       else
     {
-       log_error(_("Call stack non-empty at end of ExecutableCode run (limits 
hit?)"));
-       // TOOD:
-       // bug #20740 contains a movie that fails an assertion if we clean the 
call stack here
-       // maybe global code was executed as effect of a function code (think 
gotoFrame, attachMovie ?)
-       // We'll keep the verbose error for now, but let's not clean the call 
frame, shouldn't
-       // hurt anyway..
-       // A better implementation would likely be taking note of the 
callStackDepth at startup
-       // (like for _initial_stack_size) and check it here for consistency 
(and proper cleanup
-       // on limits hit).
-       //env.clearCallFrames();
+               // TODO: make this an assertion ?
+               log_error(_("Call stack at end of ActionScript execution "
+                       "(" SIZET_FMT ") less then call stack depth at start "
+                       "of it (" SIZET_FMT ") - bad bug !"),
+                        currCallStackDepth, _initialCallStackDepth);
+       }
     }
 
     // check if the stack was smashed

Index: server/vm/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/vm/ActionExec.h      1 Jul 2007 10:54:36 -0000       1.19
+++ server/vm/ActionExec.h      10 Aug 2007 15:17:44 -0000      1.20
@@ -100,8 +100,12 @@
        /// The 'this' pointer, if this is a function call
        boost::intrusive_ptr<as_object> _this_ptr;
 
+       /// Stack size at start of execution
        size_t _initial_stack_size;
 
+       /// Call stack depth at start of execution
+       size_t _initialCallStackDepth;
+
        character* _original_target;
 
        /// Warn about a stack underrun and fix it 




reply via email to

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