gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/avm2 r9479: Fix bug that causes read_S32 t


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9479: Fix bug that causes read_S32 to always throw an exception.
Date: Sun, 17 Aug 2008 21:16:54 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9479
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Sun 2008-08-17 21:16:54 +0800
message:
  Fix bug that causes read_S32 to always throw an exception.
modified:
  libcore/vm/CodeStream.h
=== modified file 'libcore/vm/CodeStream.h'
--- a/libcore/vm/CodeStream.h   2008-04-22 10:42:53 +0000
+++ b/libcore/vm/CodeStream.h   2008-08-17 13:16:54 +0000
@@ -169,9 +169,15 @@
        /// Read a signed integer encoded in 24 bits.
        boost::int32_t read_S24()
        {
-               if (mEnd - mCurrent < 3)
-                       throw CodeStreamException();
-               int result = *mCurrent++ + (*mCurrent++ << 8) + (*mCurrent ++ 
<< 16);
+               if (mEnd == mCurrent)
+                       throw CodeStreamException();
+               int result = *mCurrent++;
+               if(mEnd == mCurrent)
+                       throw CodeStreamException();
+               result += (*mCurrent++ << 8);
+               if(mEnd== mCurrent)
+                       throw CodeStreamException();
+               result += (*mCurrent ++ << 16);
                if (result & (1 << 23)) // Negative result, adjust 
appropriately.
                        result = -(result & ~(1 << 23));
                return static_cast<boost::int32_t>(result);


reply via email to

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