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

Unified Diff: src/gdef.cc

Issue 6410047: OTS: Adds more layout common table supports.... (Closed) Base URL: http://ots.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 10 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 | « src/gdef.h ('k') | src/layout.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gdef.cc
===================================================================
--- src/gdef.cc (revision 50)
+++ src/gdef.cc (working copy)
@@ -4,6 +4,7 @@
#include "gdef.h"
+#include <limits>
#include <vector>
#include "layout.h"
@@ -40,6 +41,9 @@
return OTS_FAILURE();
}
const unsigned attach_points_end = static_cast<unsigned>(4) + 2*glyph_count;
+ if (attach_points_end > std::numeric_limits<uint16_t>::max()) {
+ return OTS_FAILURE();
+ }
if (offset_coverage == 0 || offset_coverage >= length ||
offset_coverage < attach_points_end) {
return OTS_FAILURE();
@@ -105,6 +109,9 @@
return OTS_FAILURE();
}
const unsigned lig_glyphs_end = static_cast<unsigned>(4) + 2*lig_glyph_count;
+ if (lig_glyphs_end > std::numeric_limits<uint16_t>::max()) {
+ return OTS_FAILURE();
+ }
if (offset_coverage == 0 || offset_coverage >= length ||
offset_coverage < lig_glyphs_end) {
return OTS_FAILURE();
@@ -207,6 +214,9 @@
}
const unsigned mark_sets_end = static_cast<unsigned>(4) + 2*mark_set_count;
+ if (mark_sets_end > std::numeric_limits<uint16_t>::max()) {
+ return OTS_FAILURE();
+ }
for (unsigned i = 0; i < mark_set_count; ++i) {
uint32_t offset_coverage = 0;
if (!subtable.ReadU32(&offset_coverage)) {
@@ -221,6 +231,7 @@
return OTS_FAILURE();
}
}
+ file->gdef->num_mark_glyph_sets = mark_set_count;
return true;
}
@@ -277,6 +288,10 @@
const unsigned gdef_header_end = static_cast<unsigned>(8) +
gdef->version_2 ? static_cast<unsigned>(2) : static_cast<unsigned>(0);
+ if (gdef_header_end > std::numeric_limits<uint16_t>::max()) {
+ return OTS_FAILURE();
+ }
+
// Parse subtables
if (offset_glyph_class_def) {
if (offset_glyph_class_def >= length ||
@@ -329,6 +344,7 @@
DROP_THIS_TABLE;
return true;
}
+ gdef->has_mark_attachment_class_def = true;
}
if (offset_mark_glyph_sets_def) {
@@ -343,6 +359,7 @@
DROP_THIS_TABLE;
return true;
}
+ gdef->has_mark_glyph_sets_def = true;
}
gdef->data = data;
gdef->length = length;
« no previous file with comments | « src/gdef.h ('k') | src/layout.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698