fonts: Use empty glyphs on cache miss.
In case of a cache miss, we end up using a glyph with garbage memory which can result in arbitrary memory allocations for generating images for these glyphs. Use empty glyphs instead. R=herb@google.com Bug: skia:7913 Change-Id: Ie81b006a6872e077f9fd37e0a5751750c66f9ecb Reviewed-on: https://skia-review.googlesource.com/128701 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
This commit is contained in:
parent
53ea91139a
commit
2d2fedd25d
@ -700,6 +700,8 @@ void SkStrikeClient::generateFontMetrics(const SkTypefaceProxy& typefaceProxy,
|
|||||||
SkDebugf("generateFontMetrics: %s\n", rec.dump().c_str());
|
SkDebugf("generateFontMetrics: %s\n", rec.dump().c_str());
|
||||||
SkStrikeCache::Dump();
|
SkStrikeCache::Dump();
|
||||||
SkDEBUGFAIL("GlyphCacheMiss");
|
SkDEBUGFAIL("GlyphCacheMiss");
|
||||||
|
|
||||||
|
sk_bzero(metrics, sizeof(*metrics));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkStrikeClient::generateMetricsAndImage(const SkTypefaceProxy& typefaceProxy,
|
void SkStrikeClient::generateMetricsAndImage(const SkTypefaceProxy& typefaceProxy,
|
||||||
@ -710,6 +712,8 @@ void SkStrikeClient::generateMetricsAndImage(const SkTypefaceProxy& typefaceProx
|
|||||||
SkDebugf("generateMetricsAndImage: %s\n", rec.dump().c_str());
|
SkDebugf("generateMetricsAndImage: %s\n", rec.dump().c_str());
|
||||||
SkStrikeCache::Dump();
|
SkStrikeCache::Dump();
|
||||||
SkDEBUGFAIL("GlyphCacheMiss");
|
SkDEBUGFAIL("GlyphCacheMiss");
|
||||||
|
|
||||||
|
glyph->zeroMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkStrikeClient::generatePath(const SkTypefaceProxy& typefaceProxy,
|
void SkStrikeClient::generatePath(const SkTypefaceProxy& typefaceProxy,
|
||||||
|
@ -39,7 +39,7 @@ void SkScalerContextProxy::generateImage(const SkGlyph& glyph) {
|
|||||||
|
|
||||||
bool SkScalerContextProxy::generatePath(SkGlyphID glyphID, SkPath* path) {
|
bool SkScalerContextProxy::generatePath(SkGlyphID glyphID, SkPath* path) {
|
||||||
fClient->generatePath(*this->typefaceProxy(), this->getRec(), glyphID, path);
|
fClient->generatePath(*this->typefaceProxy(), this->getRec(), glyphID, path);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkScalerContextProxy::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
void SkScalerContextProxy::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||||
|
Loading…
Reference in New Issue
Block a user