[cff-common] In INDEX, return empty bytes if length is zero

Before it was possible to return non-null arrayZ.
This commit is contained in:
Behdad Esfahbod 2022-05-13 13:53:17 -06:00
parent a2f132f1fc
commit 2d2f66e1a3
1 changed files with 3 additions and 1 deletions

View File

@ -228,7 +228,9 @@ struct CFFIndex
hb_ubytes_t operator [] (unsigned int index) const
{
if (unlikely (index >= count)) return hb_ubytes_t ();
return hb_ubytes_t (data_base () + offset_at (index) - 1, length_at (index));
unsigned length = length_at (index);
if (unlikely (!length)) return hb_ubytes_t ();
return hb_ubytes_t (data_base () + offset_at (index) - 1, length);
}
unsigned int get_size () const