bug 670901 pt 2 - fix some typos and missing warning messages in OTS. r=jdaggett

This commit is contained in:
Jonathan Kew 2012-05-29 23:44:50 +01:00
parent 9913028a98
commit 5d3c693bcf
3 changed files with 38 additions and 15 deletions

View File

@ -267,7 +267,9 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
uint32_t version = 0;
if (!table.ReadU32(&version)) {
return OTS_FAILURE();
OTS_WARNING("incomplete GDEF table");
DROP_THIS_TABLE;
return true;
}
if (version < 0x00010000 || version == 0x00010001) {
OTS_WARNING("bad GDEF version");
@ -287,12 +289,16 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
!table.ReadU16(&offset_attach_list) ||
!table.ReadU16(&offset_lig_caret_list) ||
!table.ReadU16(&offset_mark_attach_class_def)) {
return OTS_FAILURE();
OTS_WARNING("incomplete GDEF table");
DROP_THIS_TABLE;
return true;
}
uint16_t offset_mark_glyph_sets_def = 0;
if (gdef->version_2) {
if (!table.ReadU16(&offset_mark_glyph_sets_def)) {
return OTS_FAILURE();
OTS_WARNING("incomplete GDEF table");
DROP_THIS_TABLE;
return true;
}
}
@ -304,11 +310,14 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (offset_glyph_class_def) {
if (offset_glyph_class_def >= length ||
offset_glyph_class_def < gdef_header_end) {
return OTS_FAILURE();
OTS_WARNING("invalid offset to glyph classes");
DROP_THIS_TABLE;
return true;
}
if (!ParseGlyphClassDefTable(file, data + offset_glyph_class_def,
length - offset_glyph_class_def,
num_glyphs)) {
OTS_WARNING("invalid glyph classes");
DROP_THIS_TABLE;
return true;
}
@ -318,11 +327,14 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (offset_attach_list) {
if (offset_attach_list >= length ||
offset_attach_list < gdef_header_end) {
return OTS_FAILURE();
OTS_WARNING("invalid offset to attachment list");
DROP_THIS_TABLE;
return true;
}
if (!ParseAttachListTable(file, data + offset_attach_list,
length - offset_attach_list,
num_glyphs)) {
OTS_WARNING("invalid attachment list");
DROP_THIS_TABLE;
return true;
}
@ -331,11 +343,14 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (offset_lig_caret_list) {
if (offset_lig_caret_list >= length ||
offset_lig_caret_list < gdef_header_end) {
return OTS_FAILURE();
OTS_WARNING("invalid offset to lig-caret list");
DROP_THIS_TABLE;
return true;
}
if (!ParseLigCaretListTable(file, data + offset_lig_caret_list,
length - offset_lig_caret_list,
num_glyphs)) {
OTS_WARNING("invalid ligature caret list");
DROP_THIS_TABLE;
return true;
}
@ -344,12 +359,14 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (offset_mark_attach_class_def) {
if (offset_mark_attach_class_def >= length ||
offset_mark_attach_class_def < gdef_header_end) {
OTS_WARNING("invalid offset to mark attachment list");
return OTS_FAILURE();
}
if (!ParseMarkAttachClassDefTable(file,
data + offset_mark_attach_class_def,
length - offset_mark_attach_class_def,
num_glyphs)) {
OTS_WARNING("invalid mark attachment list");
DROP_THIS_TABLE;
return true;
}
@ -359,12 +376,14 @@ bool ots_gdef_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (offset_mark_glyph_sets_def) {
if (offset_mark_glyph_sets_def >= length ||
offset_mark_glyph_sets_def < gdef_header_end) {
OTS_WARNING("invalid offset to mark glyph sets");
return OTS_FAILURE();
}
if (!ParseMarkGlyphSetsDefTable(file,
data + offset_mark_glyph_sets_def,
length - offset_mark_glyph_sets_def,
num_glyphs)) {
OTS_WARNING("invalid mark glyph sets");
DROP_THIS_TABLE;
return true;
}

View File

@ -744,7 +744,9 @@ bool ots_gpos_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
!table.ReadU16(&offset_script_list) ||
!table.ReadU16(&offset_feature_list) ||
!table.ReadU16(&offset_lookup_list)) {
return OTS_FAILURE();
OTS_WARNING("incomplete GPOS table");
DROP_THIS_TABLE;
return true;
}
if (version != 0x00010000) {
@ -767,7 +769,7 @@ bool ots_gpos_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
length - offset_lookup_list,
&kGposLookupSubtableParser,
&gpos->num_lookups)) {
OTS_WARNING("faild to parse lookup list table");
OTS_WARNING("failed to parse lookup list table");
DROP_THIS_TABLE;
return true;
}
@ -776,14 +778,14 @@ bool ots_gpos_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (!ParseFeatureListTable(data + offset_feature_list,
length - offset_feature_list, gpos->num_lookups,
&num_features)) {
OTS_WARNING("faild to parse feature list table");
OTS_WARNING("failed to parse feature list table");
DROP_THIS_TABLE;
return true;
}
if (!ParseScriptListTable(data + offset_script_list,
length - offset_script_list, num_features)) {
OTS_WARNING("faild to parse script list table");
OTS_WARNING("failed to parse script list table");
DROP_THIS_TABLE;
return true;
}

View File

@ -221,7 +221,7 @@ bool ParseAlternateSetTable(const uint8_t *data, const size_t length,
return OTS_FAILURE();
}
if (alternate >= num_glyphs) {
OTS_WARNING("too arge alternate: %u", alternate);
OTS_WARNING("too large alternate: %u", alternate);
return OTS_FAILURE();
}
}
@ -608,7 +608,9 @@ bool ots_gsub_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
!table.ReadU16(&offset_script_list) ||
!table.ReadU16(&offset_feature_list) ||
!table.ReadU16(&offset_lookup_list)) {
return OTS_FAILURE();
OTS_WARNING("incomplete GSUB table");
DROP_THIS_TABLE;
return true;
}
if (version != 0x00010000) {
@ -631,7 +633,7 @@ bool ots_gsub_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
length - offset_lookup_list,
&kGsubLookupSubtableParser,
&gsub->num_lookups)) {
OTS_WARNING("faild to parse lookup list table");
OTS_WARNING("failed to parse lookup list table");
DROP_THIS_TABLE;
return true;
}
@ -640,14 +642,14 @@ bool ots_gsub_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
if (!ParseFeatureListTable(data + offset_feature_list,
length - offset_feature_list, gsub->num_lookups,
&num_features)) {
OTS_WARNING("faild to parse feature list table");
OTS_WARNING("failed to parse feature list table");
DROP_THIS_TABLE;
return true;
}
if (!ParseScriptListTable(data + offset_script_list,
length - offset_script_list, num_features)) {
OTS_WARNING("faild to parse script list table");
OTS_WARNING("failed to parse script list table");
DROP_THIS_TABLE;
return true;
}