gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_environment.cpp serve...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/as_environment.cpp serve...
Date: Fri, 25 May 2007 13:25:47 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/25 13:25:47

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

Log message:
                * server/as_environment.cpp: don't print a separate error
                  when call stack limit is exceeded, leave that to the
                  exception handler.
                * server/vm/ActionExec.cpp: implement number of iterations
                  limit (should be a timeout in second actually, but better
                  this then hanging forever). Fixes bug #19961.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3354&r2=1.3355
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.77&r2=1.78
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.33&r2=1.34

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3354
retrieving revision 1.3355
diff -u -b -r1.3354 -r1.3355
--- ChangeLog   25 May 2007 12:41:48 -0000      1.3354
+++ ChangeLog   25 May 2007 13:25:47 -0000      1.3355
@@ -1,3 +1,12 @@
+2007-05-25 Sandro Santilli <address@hidden>
+
+       * server/as_environment.cpp: don't print a separate error
+         when call stack limit is exceeded, leave that to the 
+         exception handler.
+       * server/vm/ActionExec.cpp: implement number of iterations
+         limit (should be a timeout in second actually, but better
+         this then hanging forever). Fixes bug #19961.
+
 2007-05-25 Bastiaan Jacques <address@hidden>
 
        * server/swf/tag_loaders.cpp: Move the assignment into the data

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- server/as_environment.cpp   14 May 2007 12:23:39 -0000      1.77
+++ server/as_environment.cpp   25 May 2007 13:25:47 -0000      1.78
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: as_environment.cpp,v 1.77 2007/05/14 12:23:39 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.78 2007/05/25 13:25:47 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -993,10 +993,12 @@
 
        if ( _localFrames.size() == maxstacksize )
        {
-               log_error(_("Max stack count reached (%u) - should abort 
execution"),
+               char buf[256];
+               snprintf(buf, 255, _("Max stack count reached (%u)"),
                                maxstacksize);
+
                // throw something
-               throw ActionLimitException("Call stack limit exceeded");
+               throw ActionLimitException(buf); 
        }
        _localFrames.push_back(CallFrame(func));
 }

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/vm/ActionExec.cpp    21 May 2007 06:53:36 -0000      1.33
+++ server/vm/ActionExec.cpp    25 May 2007 13:25:47 -0000      1.34
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: ActionExec.cpp,v 1.33 2007/05/21 06:53:36 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.34 2007/05/25 13:25:47 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -160,8 +160,11 @@
        );
 #endif
 
+       size_t branchCount = 0;
        try {
-       while (pc<stop_pc) {
+       while (pc<stop_pc)
+       {
+
            // Cleanup any expired "with" blocks.
            while ( ! with_stack.empty() && pc >= with_stack.back().end_pc() ) {
                // Drop last stack element
@@ -172,6 +175,7 @@
 
        // Get the opcode.
        uint8_t action_id = code[pc];
+       size_t oldPc = pc;
 
        IF_VERBOSE_ACTION (
                // FIXME, avoid direct dbglogfile access, use log_action
@@ -236,14 +240,36 @@
        // Control flow actions will change the PC (next_pc)
        pc = next_pc;
 
+       // Check for loop backs. Actually this should be implemented
+       // as a timeout in seconds.
+       // See: http://www.gnashdev.org/wiki/index.php/ScriptLimits
+       // 
+       if ( pc < oldPc )
+       {
+               // TODO: specify in the .gnashrc ?
+               size_t maxBranchCount = 512; // what's enough ?
+               if ( ++branchCount > maxBranchCount )
+               {
+                       char buf[256];
+                       snprintf(buf, 255, _("Loop iterations count exceeded 
limit of %u"),
+                               maxBranchCount);
+                       throw ActionLimitException(buf);
+               }
+               //log_debug("Branch count: %u", branchCount);
+       }
+
     }
 
     }
     catch (ActionLimitException& ex)
     {
-           IF_VERBOSE_ASCODING_ERRORS (
-           log_aserror("%s", ex.what());
-           )
+           // We want to always show these messages, as in the future
+           // we'll eventually need to pop up a window asking user about
+           // what to do instead..
+           //
+           //IF_VERBOSE_ASCODING_ERRORS (
+           log_swferror("Script aborted due to exceeded limit: %s", ex.what());
+           //)
     }
 
     cleanupAfterRun();




reply via email to

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