Merge pull request #98 from rsheeter/master

Fix woff2_compress fuzzer bugs
This commit is contained in:
rsheeter
2017-10-13 13:16:02 -07:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -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();
}
}
}
+4 -1
View File
@@ -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;
}