gnash-commit
[Top][All Lists]
Advanced

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

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


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp
Date: Fri, 23 May 2008 12:01:10 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/05/23 12:01:10

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

Log message:
                * server/vm/ASHandlers.cpp: bitwise left shift of more than the 
size of
                  the left operand is bad (undefined behaviour).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6688&r2=1.6689
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.241&r2=1.242

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6688
retrieving revision 1.6689
diff -u -b -r1.6688 -r1.6689
--- ChangeLog   23 May 2008 11:23:29 -0000      1.6688
+++ ChangeLog   23 May 2008 12:01:09 -0000      1.6689
@@ -1,5 +1,10 @@
 2008-05-23 Benjamin Wolsey <address@hidden>
 
+       * server/vm/ASHandlers.cpp: bitwise left shift of more than the size of
+         the left operand is bad (undefined behaviour).
+
+2008-05-23 Benjamin Wolsey <address@hidden>
+
        * server/vm/ASHandlers.cpp: drop many dead, old debugging messages,
          drop all to_debug_string() and c_str() in logging (except log_trace,
          comment added). Use to_int() instead of to_number() more.

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -b -r1.241 -r1.242
--- server/vm/ASHandlers.cpp    23 May 2008 11:23:30 -0000      1.241
+++ server/vm/ASHandlers.cpp    23 May 2008 12:01:10 -0000      1.242
@@ -3824,7 +3824,12 @@
     as_environment& env = thread.env;
     thread.ensureStack(2);
 
-    boost::uint32_t amount = env.top(0).to_int();
+    /// A left shift of more than or equal to the size in
+    /// bits of the left operand, or a negative shift, results
+    /// in undefined behaviour in C++.
+    boost::int32_t amount = env.top(0).to_int() % 32;
+    if (amount < 0) amount += 32;
+    
     boost::int32_t value = env.top(1).to_int();
 
     value = value << amount;




reply via email to

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