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

Unified Diff: third_party/woff2/src/font.cc

Issue 2736873002: Update woff2 to cbea7b9 (Closed)
Patch Set: Created 3 years, 9 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 | « third_party/woff2/src/font.h ('k') | third_party/woff2/src/glyph.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/woff2/src/font.cc
diff --git a/third_party/woff2/src/font.cc b/third_party/woff2/src/font.cc
index 3679a4c0d3b831cdbad175985670204bcdb4ccae..fc496e05931af197a4b358b67ac2d08a579d20db 100644
--- a/third_party/woff2/src/font.cc
+++ b/third_party/woff2/src/font.cc
@@ -105,6 +105,12 @@ bool ReadTrueTypeFont(Buffer* file, const uint8_t* data, size_t len,
last_offset = i.first + i.second;
}
+ // Sanity check key tables
+ const Font::Table* head_table = font->FindTable(kHeadTableTag);
+ if (head_table != NULL && head_table->length < 52) {
+ return FONT_COMPRESSION_FAILURE();
+ }
+
return true;
}
@@ -181,15 +187,14 @@ bool ReadFontCollection(const uint8_t* data, size_t len,
FontCollection* font_collection) {
Buffer file(data, len);
- uint32_t flavor;
- if (!file.ReadU32(&flavor)) {
+ if (!file.ReadU32(&font_collection->flavor)) {
return FONT_COMPRESSION_FAILURE();
}
- if (flavor != kTtcFontFlavor) {
+ if (font_collection->flavor != kTtcFontFlavor) {
font_collection->fonts.resize(1);
Font& font = font_collection->fonts[0];
- font.flavor = flavor;
+ font.flavor = font_collection->flavor;
return ReadTrueTypeFont(&file, data, len, &font);
}
return ReadTrueTypeCollection(&file, data, len, font_collection);
@@ -286,7 +291,7 @@ bool WriteFontCollection(const FontCollection& font_collection, uint8_t* dst,
size_t offset = 0;
// It's simpler if this just a simple sfnt
- if (font_collection.fonts.size() == 1) {
+ if (font_collection.flavor != kTtcFontFlavor) {
return WriteFont(font_collection.fonts[0], &offset, dst, dst_size);
}
« no previous file with comments | « third_party/woff2/src/font.h ('k') | third_party/woff2/src/glyph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698