[gvar] Protect against out-of-range access
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47281 Fixes https://oss-fuzz.com/testcase-detail/5508865908670464
This commit is contained in:
parent
f10ddb8dd8
commit
ca8a0f3ea3
|
@ -490,7 +490,10 @@ struct gvar
|
|||
bool is_long_offset () const { return flags & 1; }
|
||||
|
||||
unsigned get_offset (unsigned i) const
|
||||
{ return is_long_offset () ? get_long_offset_array ()[i] : get_short_offset_array ()[i] * 2; }
|
||||
{
|
||||
if (unlikely (i > glyphCount)) return 0;
|
||||
return is_long_offset () ? get_long_offset_array ()[i] : get_short_offset_array ()[i] * 2;
|
||||
}
|
||||
|
||||
const HBUINT32 * get_long_offset_array () const { return (const HBUINT32 *) &offsetZ; }
|
||||
const HBUINT16 *get_short_offset_array () const { return (const HBUINT16 *) &offsetZ; }
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue