fix gvar fuzz bug

This commit is contained in:
Michiharu Ariza 2019-03-29 10:32:42 -07:00
parent 58c8c7a495
commit ddb84dcece
2 changed files with 8 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
libtool

View File

@ -511,7 +511,13 @@ struct gvar
} }
unsigned int get_glyph_var_data_length (unsigned int glyph) const unsigned int get_glyph_var_data_length (unsigned int glyph) const
{ return get_offset (glyph+1) - get_offset (glyph); } {
unsigned int end_offset = get_offset (glyph+1);
unsigned int start_offset = get_offset (glyph);
if (unlikely (start_offset > end_offset || end_offset > get_offset(glyphCount)))
return 0;
return end_offset - start_offset;
}
const HBUINT32 *get_long_offset_array () const { return (const HBUINT32 *)&offsetZ; } const HBUINT32 *get_long_offset_array () const { return (const HBUINT32 *)&offsetZ; }
const HBUINT16 *get_short_offset_array () const { return (const HBUINT16 *)&offsetZ; } const HBUINT16 *get_short_offset_array () const { return (const HBUINT16 *)&offsetZ; }