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

Side by Side Diff: src/gdef.cc

Issue 139353002: Fix offset verification in GDEF and GSUB header parsing. (Closed) Base URL: https://chromium.googlesource.com/external/ots.git@master
Patch Set: Created 6 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gsub.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gdef.h" 5 #include "gdef.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "gpos.h" 10 #include "gpos.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 !table.ReadU16(&offset_mark_attach_class_def)) { 283 !table.ReadU16(&offset_mark_attach_class_def)) {
284 return OTS_FAILURE(); 284 return OTS_FAILURE();
285 } 285 }
286 uint16_t offset_mark_glyph_sets_def = 0; 286 uint16_t offset_mark_glyph_sets_def = 0;
287 if (gdef->version_2) { 287 if (gdef->version_2) {
288 if (!table.ReadU16(&offset_mark_glyph_sets_def)) { 288 if (!table.ReadU16(&offset_mark_glyph_sets_def)) {
289 return OTS_FAILURE(); 289 return OTS_FAILURE();
290 } 290 }
291 } 291 }
292 292
293 unsigned gdef_header_end = 8; 293 unsigned gdef_header_end = 4 + 4 * 2;
294 if (gdef->version_2) 294 if (gdef->version_2)
295 gdef_header_end += 2; 295 gdef_header_end += 2;
296 296
297 // Parse subtables 297 // Parse subtables
298 if (offset_glyph_class_def) { 298 if (offset_glyph_class_def) {
299 if (offset_glyph_class_def >= length || 299 if (offset_glyph_class_def >= length ||
300 offset_glyph_class_def < gdef_header_end) { 300 offset_glyph_class_def < gdef_header_end) {
301 return OTS_FAILURE(); 301 return OTS_FAILURE();
302 } 302 }
303 if (!ParseGlyphClassDefTable(file, data + offset_glyph_class_def, 303 if (!ParseGlyphClassDefTable(file, data + offset_glyph_class_def,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 return true; 385 return true;
386 } 386 }
387 387
388 void ots_gdef_free(OpenTypeFile *file) { 388 void ots_gdef_free(OpenTypeFile *file) {
389 delete file->gdef; 389 delete file->gdef;
390 } 390 }
391 391
392 } // namespace ots 392 } // namespace ots
393 393
OLDNEW
« no previous file with comments | « no previous file | src/gsub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698