void reset ()
{
this->successful = true;
+ this->ran_out_of_room = false;
this->head = this->start;
this->debug_depth = 0;
}
template <typename Type>
Type *allocate_size (unsigned int size)
{
- if (unlikely (!this->successful || this->end - this->head < ptrdiff_t (size))) {
+ if (unlikely (!this->successful)) return nullptr;
+
+ if (this->end - this->head < ptrdiff_t (size))
+ {
+ this->ran_out_of_room = true;
this->successful = false;
return nullptr;
}
unsigned int debug_depth;
char *start, *end, *head;
bool successful;
+ bool ran_out_of_room;
};
hb_serialize_context_t serializer ((void *) buf, buf_size);
hb_subset_context_t c (plan, &serializer);
result = table->subset (&c);
- if (serializer.in_error ())
+ if (serializer.ran_out_of_room)
{
buf_size += (buf_size >> 1) + 32;
DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.", HB_UNTAG (tag), buf_size);
}
goto retry;
}
+ if (serializer.in_error ())
+ {
+ abort ();
+ }
+
if (result)
{
hb_blob_t *dest_blob = serializer.copy_blob ();