[subset] Fix another fuzzer issue
Addition could overflow on 32bit arch. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=36636 Fixes https://oss-fuzz.com/testcase-detail/5072358514753536
This commit is contained in:
parent
c65e1e0842
commit
0ded6a70c8
|
@ -519,8 +519,9 @@ struct hb_serialize_context_t
|
||||||
|
|
||||||
assert (this->start <= (char *) obj);
|
assert (this->start <= (char *) obj);
|
||||||
assert ((char *) obj <= this->head);
|
assert ((char *) obj <= this->head);
|
||||||
assert ((char *) obj + size >= this->head);
|
assert (this->head - (char *) obj <= size);
|
||||||
if (unlikely (!this->allocate_size<Type> (((char *) obj) + size - this->head))) return nullptr;
|
if (unlikely (((char *) obj + size < (char *) obj) ||
|
||||||
|
!this->allocate_size<Type> (((char *) obj) + size - this->head))) return nullptr;
|
||||||
return reinterpret_cast<Type *> (obj);
|
return reinterpret_cast<Type *> (obj);
|
||||||
}
|
}
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue