Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1534)

Unified Diff: src/ports/SkTypeface_win_dw.cpp

Issue 1218043004: Add check that Dwrite glyph fits in unicode table. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: code review 2 Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkTypeface_win_dw.cpp
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 25de1b6578e34e96c14968896837c3f299db66f9..95ab6122f9f8d25337134fe2b55351cb78776d75 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698