Index: src/ports/SkFontHost_FreeType.cpp |
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp |
index 55eb87fe6d4bfadb8eadfaf01ec78128e5981855..6f84320bc8855f9d65698dd715169c9c45915842 100644 |
--- a/src/ports/SkFontHost_FreeType.cpp |
+++ b/src/ports/SkFontHost_FreeType.cpp |
@@ -445,12 +445,14 @@ static bool getWidthAdvance(FT_Face face, int gId, int16_t* data) { |
} |
static void populate_glyph_to_unicode(FT_Face& face, SkTDArray<SkUnichar>* glyphToUnicode) { |
- glyphToUnicode->setCount(face->num_glyphs); |
- sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * face->num_glyphs); |
+ unsigned arrayLength = SkToUInt(face->num_glyphs); |
bungeman-skia
2016/04/19 17:59:14
This is a rather confusing name, since there is no
hal.canary
2016/04/20 15:06:43
Done.
|
+ glyphToUnicode->setCount(SkToInt(arrayLength)); |
bungeman-skia
2016/04/19 17:59:14
SkToInt is a good idea.
|
+ sk_bzero(glyphToUnicode->begin(), sizeof((*glyphToUnicode)[0]) * arrayLength); |
FT_UInt glyphIndex; |
SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex); |
while (glyphIndex) { |
+ SkASSERT(glyphIndex < arrayLength); |
(*glyphToUnicode)[glyphIndex] = charCode; |
charCode = FT_Get_Next_Char(face, charCode, &glyphIndex); |
} |