[Chromium] Uninitialized access in SimpleFontDataSkia::platformInit
[WebKit-https.git] / Source / WebCore / platform / graphics / skia / SimpleFontDataSkia.cpp
index 782b02fa9327b7bf67887070e014e9391bbe71e1..65a468ef3d78affd44affbb6f4fe894564f46540 100644 (file)
@@ -139,8 +139,14 @@ void SimpleFontData::platformInit()
             static const UChar32 xChar = 'x';
             const Glyph xGlyph = glyphPageZero->glyphDataForCharacter(xChar).glyph;
 
-            if (xGlyph)
+            if (xGlyph) {
+                // In widthForGlyph(), xGlyph will be compared with
+                // m_zeroWidthSpaceGlyph, which isn't initialized yet here.
+                // Initialize it with zero to make sure widthForGlyph() returns
+                // the right width.
+                m_zeroWidthSpaceGlyph = 0;
                 m_avgCharWidth = widthForGlyph(xGlyph);
+            }
         }
     }
 }