Skip to content

Commit

Permalink
Merge pull request #98 from rsheeter/master
Browse files Browse the repository at this point in the history
Fix woff2_compress fuzzer bugs
  • Loading branch information
rsheeter authored Oct 13, 2017
2 parents 550cfa6 + 677800f commit 5bbcf1f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/font.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ bool ReadCollectionFont(Buffer* file, const uint8_t* data, size_t len,
(*all_tables)[table.offset] = font->FindTable(table.tag);
} else {
table.reuse_of = (*all_tables)[table.offset];
if (table.tag != table.reuse_of->tag) {
return FONT_COMPRESSION_FAILURE();
}
}

}
Expand Down
5 changes: 4 additions & 1 deletion src/normalize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ bool MakeEditableBuffer(Font* font, int tableTag) {
int sz = Round4(table->length);
table->buffer.resize(sz);
uint8_t* buf = &table->buffer[0];
memcpy(buf, table->data, sz);
memcpy(buf, table->data, table->length);
if (PREDICT_FALSE(sz > table->length)) {
memset(buf + table->length, 0, sz - table->length);
}
table->data = buf;
return true;
}
Expand Down

0 comments on commit 5bbcf1f

Please sign in to comment.