gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp
Date: Sat, 01 Jul 2006 00:30:02 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/07/01 00:30:02

Modified files:
        .              : ChangeLog 
        server/swf     : ASHandlers.cpp 

Log message:
                * server/swf/ASHandlers.cpp: fixed bugus stack drop             
                in ActionWaitForFrame, added pseudo-code implementation of
                it and ActionWaitForFrameExpresion.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.450&r2=1.451
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.24&r2=1.25

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.450
retrieving revision 1.451
diff -u -b -r1.450 -r1.451
--- ChangeLog   30 Jun 2006 20:07:43 -0000      1.450
+++ ChangeLog   1 Jul 2006 00:30:01 -0000       1.451
@@ -1,5 +1,8 @@
 2006-06-30 Sandro Santilli <address@hidden>
 
+       * server/swf/ASHandlers.cpp: fixed bugus stack drop
+       in ActionWaitForFrame, added pseudo-code implementation of
+       it and ActionWaitForFrameExpresion.
        * server/swf/ASHandlers.cpp, server/swf/ASHandlers.h:
        added ensure_stack() function to use by action handlers
        to check stack size before attempting to fetch from it.

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/swf/ASHandlers.cpp   30 Jun 2006 20:07:44 -0000      1.24
+++ server/swf/ASHandlers.cpp   1 Jul 2006 00:30:02 -0000       1.25
@@ -607,24 +607,35 @@
 //     GNASH_REPORT_FUNCTION;
 
        as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
 
-       ensure_stack(env, 1);
+       assert( code[thread.pc] == SWF::ACTION_WAITFORFRAME );
+
+       // SWF integrity check
+       size_t tag_len = code.read_int16(thread.pc+1);
+       if ( tag_len != 3 )
+       {
+               log_warning("Malformed SWF: ActionWaitForFrame (0x%X) tag 
length == %d (expected 3)", SWF::ACTION_WAITFORFRAME, tag_len);
+       }
+
+       // we don't use the stack!
+       //ensure_stack(env, 1);
 
        // If we haven't loaded a specified frame yet, then we're supposed
        // to skip some specified number of actions.
        //
        // Since we don't load incrementally, just ignore this opcode.
 
-#if 0 // replaced by ensure_stack() above
-       if ( env.stack_size() < 1 )
+       unsigned int framenum = code.read_int16(thread.pc+3);
+       int skip = code[thread.pc+4];
+
+#if 0 // pseudo-code, to be implemented
+       if ( target.loaded_frames() < framenum )
        {
-               log_error("Empty stack on ActionWaitForFrame. Bogus SWF?");
-               // yeah.. as if gnash was bugfree :)
-               return;
+               // better delegate this to ActionExec
+               thread.skip_actions(skip);
        }
-#endif // 0
-
-       env.drop(1);
+#endif
 
        dbglogfile << __PRETTY_FUNCTION__
                << ": unimplemented (no need until we play while reading)"
@@ -1222,11 +1233,33 @@
     dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
 }
 
+// also known as WaitForFrame2
 void
 SWFHandlers::ActionWaitForFrameExpression(ActionExec& thread)
 {
 //    GNASH_REPORT_FUNCTION;
     as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       ensure_stack(env, 1); // expression
+
+       // how many actions to skip if frame has not been loaded
+       short unsigned int skip = code[thread.pc+3];
+
+       // env.top(0) contains frame specification,
+       // evaluated as for ActionGotoExpression
+
+#if 0 // pseudo-code, to be implemented
+       as_value& framespec = env.top(0);
+       if ( ! target.find_frame(framespec) )
+       {
+               // better delegate this to ActionExec
+               thread.skip_actions(skip);
+       }
+#endif
+
+       env.drop(1);
+       
     dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
 }
 




reply via email to

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