gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/array.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/array.cpp
Date: Tue, 21 Nov 2006 09:47:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/21 09:47:12

Modified files:
        .              : ChangeLog 
        server         : array.cpp 

Log message:
                * server/array.cpp (slice): handled some unexpected user input.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1688&r2=1.1689
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.41&r2=1.42

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1688
retrieving revision 1.1689
diff -u -b -r1.1688 -r1.1689
--- ChangeLog   21 Nov 2006 09:09:48 -0000      1.1688
+++ ChangeLog   21 Nov 2006 09:47:12 -0000      1.1689
@@ -1,5 +1,6 @@
 2006-11-21 Sandro Santilli <address@hidden>
 
+       * server/array.cpp (slice): handled some unexpected user input.
        * testsuite/actionscript.all/Makefile.am (make check):
          run the all-inclusive testcases (one for each target version).
        * server/mouse_button_state.h: added missing

Index: server/array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/array.cpp    11 Nov 2006 22:44:54 -0000      1.41
+++ server/array.cpp    21 Nov 2006 09:47:12 -0000      1.42
@@ -291,7 +291,35 @@
 as_array_object::slice(unsigned int start, unsigned int one_past_end)
 {
        std::auto_ptr<as_array_object> newarray(new as_array_object);
-       newarray->elements.resize(one_past_end - start - 1);
+
+       log_msg("Array.slice(%u, %u) called", start, one_past_end);
+
+       if ( one_past_end < start )
+       {
+               // Not wrapped in IF_VERBOSE_ASCODING_ERROR
+               // as I think we should support this somehow
+               log_warning("FIXME: Array.slice(%u, %u) called - "
+                       "expected second argument to be greather "
+                       "or equal first one. What to do in these cases ?",
+                       start, one_past_end);
+               return newarray;
+       }
+
+       size_t newsize = one_past_end - start + 1;
+
+       if ( newsize < elements.size() )
+       {
+               // Not wrapped in IF_VERBOSE_ASCODING_ERROR
+               // as I think we should support this somehow
+               log_warning("FIXME: Array.slice(%u, %u) called on an array "
+                       "with less elements then requested "
+                       "(want %u, have %u). What to do in these cases ?",
+                       start, one_past_end,
+                       newsize, elements.size());
+               return newarray;
+       }
+
+       newarray->elements.resize(newsize);
 
        // maybe there's a standard algorithm for this ?
        for (unsigned int i=start; i<one_past_end; ++i)




reply via email to

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