aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar wfh <wfh@chromium.org>2015-07-07 18:06:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-07 18:06:19 -0700
commitf7b54cda0d44cb1e7fd89586ff8ff3b78dfb823b (patch)
tree8a7760467e1c999e65ad332576be47e56910c741 /src
parenteeff8bb8ffdd6e77823a23bad3d23e4f15057681 (diff)
Add check that Dwrite glyph fits in unicode table.
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkTypeface_win_dw.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 25de1b6578..95ab6122f9 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -286,15 +286,17 @@ using namespace skia_advanced_typeface_metrics_utils;
static void populate_glyph_to_unicode(IDWriteFontFace* fontFace,
const unsigned glyphCount,
SkTDArray<SkUnichar>* glyphToUnicode) {
- HRESULT hr = S_OK;
-
//Do this like free type instead
SkAutoTMalloc<SkUnichar> glyphToUni(glyphCount);
int maxGlyph = -1;
for (UINT32 c = 0; c < 0x10FFFF; ++c) {
- UINT16 glyph;
- hr = fontFace->GetGlyphIndices(&c, 1, &glyph);
- SkASSERT(glyph < glyphCount);
+ UINT16 glyph = 0;
+ HRVM(fontFace->GetGlyphIndices(&c, 1, &glyph),
+ "Failed to get glyph index.");
+ // Intermittent DW bug on Windows 10. See crbug.com/470146.
+ if (glyph >= glyphCount) {
+ return;
+ }
if (0 < glyph) {
maxGlyph = SkTMax(static_cast<int>(glyph), maxGlyph);
glyphToUni[glyph] = c;