bug 890277 - ANGLE libGLESv2 Integer Overflow - r=bjacob, a=bajaj
authorGuillaume Abadie <gabadie@mozilla.com>
Wed, 24 Jul 2013 17:57:41 -0400
changeset 148407 229a2402debc6bc0ee9dcf8f789a99775cc64c1a
parent 148406 ecb5878a171739a7ee6011e2f8baa68044195a14
child 148408 e7118e2596b150f07d010c576b035b5b22571a3c
push id2789
push userbjacob@mozilla.com
push dateThu, 22 Aug 2013 09:23:59 +0000
treeherdermozilla-beta@229a2402debc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob, bajaj
bugs890277
milestone24.0
bug 890277 - ANGLE libGLESv2 Integer Overflow - r=bjacob, a=bajaj
gfx/angle/README.mozilla
gfx/angle/angle-line-loop-overflow.patch
gfx/angle/src/libGLESv2/IndexDataManager.cpp
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -29,16 +29,21 @@ In this order:
   
   angle-default-clamp-strat.patch:
     Fixes TCompiler::Init to treat `resources.ArrayIndexClampingStrategy`
     as a request for the default strategy.
 
   angle-cross-compilation.patch
     Fixes cross compilation on case sensitive OSes.
 
+  angle-line-loop-overflow.patch
+    Fixes a forgotten overflow check on drawing line loop
+    ANGLE bug : http://code.google.com/p/angleproject/issues/detail?id=444
+    ANGLE revision : 07dda9519cf4
+
 In addition to these patches, the Makefile.in files are ours, they're not present in
 upsteam ANGLE. Therefore, changes made to the Makefile.in files should not be stored
 in the local .patch files.
 
 
 == How to do a clean-slate upgrade ==
 1.  Backup our moz-specific files:
       README.mozilla
new file mode 100644
--- /dev/null
+++ b/gfx/angle/angle-line-loop-overflow.patch
@@ -0,0 +1,26 @@
+# HG changeset patch
+# Parent 308e3cf5ba75fdf8ed3bdd3dc766410b708b98ef
+
+diff --git a/gfx/angle/src/libGLESv2/IndexDataManager.cpp b/gfx/angle/src/libGLESv2/IndexDataManager.cpp
+--- a/gfx/angle/src/libGLESv2/IndexDataManager.cpp
++++ b/gfx/angle/src/libGLESv2/IndexDataManager.cpp
+@@ -375,17 +375,18 @@ void StreamingIndexBuffer::reserveSpace(
+     
+         if (FAILED(result))
+         {
+             ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
+         }
+ 
+         mWritePosition = 0;
+     }
+-    else if (mWritePosition + requiredSpace > mBufferSize)   // Recycle
++    else if (mWritePosition + requiredSpace > mBufferSize ||
++             mWritePosition + requiredSpace < mWritePosition)   // Recycle
+     {
+         void *dummy;
+         mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
+         mIndexBuffer->Unlock();
+ 
+         mWritePosition = 0;
+     }
+ }
--- a/gfx/angle/src/libGLESv2/IndexDataManager.cpp
+++ b/gfx/angle/src/libGLESv2/IndexDataManager.cpp
@@ -375,17 +375,18 @@ void StreamingIndexBuffer::reserveSpace(
     
         if (FAILED(result))
         {
             ERR("Out of memory allocating a vertex buffer of size %lu.", mBufferSize);
         }
 
         mWritePosition = 0;
     }
-    else if (mWritePosition + requiredSpace > mBufferSize)   // Recycle
+    else if (mWritePosition + requiredSpace > mBufferSize ||
+             mWritePosition + requiredSpace < mWritePosition)   // Recycle
     {
         void *dummy;
         mIndexBuffer->Lock(0, 1, &dummy, D3DLOCK_DISCARD);
         mIndexBuffer->Unlock();
 
         mWritePosition = 0;
     }
 }