[ENOMEM] Return gracefully if stages isn't initialized correctly (#2639)
This happens if calls to 'm.lookups[table_index].push ()' has been silently failed due to lack of memory. This change just returns gracefully instead issuing the assert. Fixes https://crbug.com/oss-fuzz/24494
This commit is contained in:
parent
a0ebea5280
commit
1f8b1e7f18
|
@ -140,12 +140,12 @@ struct hb_ot_map_t
|
|||
void get_stage_lookups (unsigned int table_index, unsigned int stage,
|
||||
const struct lookup_map_t **plookups, unsigned int *lookup_count) const
|
||||
{
|
||||
if (unlikely (stage == UINT_MAX)) {
|
||||
if (unlikely (stage > stages[table_index].length))
|
||||
{
|
||||
*plookups = nullptr;
|
||||
*lookup_count = 0;
|
||||
return;
|
||||
}
|
||||
assert (stage <= stages[table_index].length);
|
||||
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
|
||||
unsigned int end = stage < stages[table_index].length ? stages[table_index][stage].last_lookup : lookups[table_index].length;
|
||||
*plookups = end == start ? nullptr : &lookups[table_index][start];
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue