Simplify copy and add fuzzing coverage

This commit is contained in:
ckitagawa 2020-01-14 14:56:02 -05:00 committed by Garret Rieger
parent 78b50a67be
commit 6bcf57eaa3
2 changed files with 2 additions and 5 deletions

View File

@ -41,19 +41,16 @@ namespace OT {
struct SBIXGlyph struct SBIXGlyph
{ {
static unsigned int get_size (unsigned int data_length)
{ return min_size + data_length * HBUINT8::static_size; }
SBIXGlyph* copy (hb_serialize_context_t *c, unsigned int data_length) const { SBIXGlyph* copy (hb_serialize_context_t *c, unsigned int data_length) const {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
SBIXGlyph* new_glyph = c->start_embed<SBIXGlyph> (); SBIXGlyph* new_glyph = c->start_embed<SBIXGlyph> ();
if (unlikely (!new_glyph)) return_trace (nullptr); if (unlikely (!new_glyph)) return_trace (nullptr);
if (unlikely (!c->extend (*new_glyph, data_length))) return_trace (nullptr); if (unlikely (!c->extend_min (new_glyph))) return_trace (nullptr);
new_glyph->xOffset = xOffset; new_glyph->xOffset = xOffset;
new_glyph->yOffset = yOffset; new_glyph->yOffset = yOffset;
new_glyph->graphicType = graphicType; new_glyph->graphicType = graphicType;
memcpy (&new_glyph->data, &data, data_length); data.copy(c, data_length);
return_trace (new_glyph); return_trace (new_glyph);
} }

BIN
test/fuzzing/fonts/sbix.ttf Normal file

Binary file not shown.