Prevent crash with long string of Indic characters. Bug 445711, r=pavlov
authorSimon Montagu <smontagu@smontagu.org>
Thu, 14 Aug 2008 11:20:46 +0300
changeset 16654 4e59007070b6bccf3ea4516e23f488a0dbe9b601
parent 16653 bb2bd5fc3efc664eede85ae70dfb050afc4064e9
child 16655 caa88224286e98dfbf7fdc79f54b01aa849d2198
push id1213
push usersmontagu@mozilla.com
push dateThu, 14 Aug 2008 08:23:47 +0000
treeherdermozilla-central@4e59007070b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspavlov
bugs445711
milestone1.9.1a2pre
Prevent crash with long string of Indic characters. Bug 445711, r=pavlov
gfx/src/thebes/crashtests/445711.html
gfx/src/thebes/crashtests/crashtests.list
gfx/thebes/src/gfxWindowsFonts.cpp
new file mode 100644
--- /dev/null
+++ b/gfx/src/thebes/crashtests/445711.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/REC-html401-19991224/strict.dtd">
+<html>
+ <head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <title>Tamil testcase</title>
+ </head>
+ <body>
+  <p>&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;&#x0BCC;</p>
+ </body>
+</html>
--- a/gfx/src/thebes/crashtests/crashtests.list
+++ b/gfx/src/thebes/crashtests/crashtests.list
@@ -1,2 +1,3 @@
 load 306902-1.xml
 load 383872-1.svg
+load 445711.html
--- a/gfx/thebes/src/gfxWindowsFonts.cpp
+++ b/gfx/thebes/src/gfxWindowsFonts.cpp
@@ -1327,19 +1327,19 @@ public:
 
             rv = ScriptShape(shapeDC, mCurrentFont->ScriptCache(),
                              str, mRangeLength,
                              mMaxGlyphs, &sa,
                              mGlyphs.Elements(), mClusters.Elements(),
                              mAttr.Elements(), &mNumGlyphs);
 
             if (rv == E_OUTOFMEMORY) {
+                mMaxGlyphs *= 2;
                 mGlyphs.SetLength(mMaxGlyphs);
                 mAttr.SetLength(mMaxGlyphs);
-                mMaxGlyphs *= 2;
                 continue;
             }
 
             if (rv == E_PENDING) {
                 if (shapeDC == mDC) {
                     // we already tried this once, something failed, give up
                     return E_PENDING;
                 }