[post] Protect against huge empty tables

This commit is contained in:
Behdad Esfahbod 2018-11-07 09:14:42 -05:00
parent 5ed816ab59
commit 7d91f07edf
1 changed files with 3 additions and 1 deletions

View File

@ -128,7 +128,9 @@ struct post
pool = &StructAfter<uint8_t> (v2.glyphNameIndex); pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
const uint8_t *end = (uint8_t *) table + table_length; const uint8_t *end = (uint8_t *) table + table_length;
for (const uint8_t *data = pool; data < end && data + *data < end; data += 1 + *data) for (const uint8_t *data = pool;
index_to_offset.len < 65535 && data < end && data + *data < end;
data += 1 + *data)
index_to_offset.push (data - pool); index_to_offset.push (data - pool);
} }
inline void fini (void) inline void fini (void)