diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 72c0c642c..855b86811 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -99,10 +99,12 @@ struct NameRecord const void *src_base, const void *dst_base) const { + TRACE_SERIALIZE (this); auto *out = c->embed (this); - out->offset = 0; + if (unlikely (!out)) return_trace (nullptr); + out->offset.serialize_copy (c, src_base + offset, dst_base, length); - return out; + return_trace (out); } bool sanitize (hb_sanitize_context_t *c, const void *base) const @@ -292,6 +294,8 @@ struct name + hb_iter (name_record_idx_to_retain) | hb_apply ([&] (unsigned _) { c->copy (src_array[_], src_base, dst_base); }) ; + + if (unlikely (c->ran_out_of_room)) return_trace (false); assert (this->stringOffset == c->length ()); diff --git a/test/api/fonts/nameID.expected.ttf b/test/api/fonts/nameID.expected.ttf index ccd4b8bcd..00aecc0bb 100644 Binary files a/test/api/fonts/nameID.expected.ttf and b/test/api/fonts/nameID.expected.ttf differ