Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/woff2/src/woff2_dec.cc

Issue 2736873002: Update woff2 to cbea7b9 (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/woff2/src/woff2_dec.h ('k') | third_party/woff2/src/woff2_enc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/woff2/src/woff2_dec.cc
diff --git a/third_party/woff2/src/woff2_dec.cc b/third_party/woff2/src/woff2_dec.cc
index 6f26a305ffdab453e7dfe017f4957edb9d9e427d..ee85fad72bfd36c65d6e629f8f232a7590b74b85 100644
--- a/third_party/woff2/src/woff2_dec.cc
+++ b/third_party/woff2/src/woff2_dec.cc
@@ -18,7 +18,6 @@
#include <stdlib.h>
#include <algorithm>
-#include <brotli/decode.h>
#include <complex>
#include <cstring>
#include <limits>
@@ -28,6 +27,7 @@
#include <memory>
#include <utility>
+#include "./brotli/decode.h"
#include "./buffer.h"
#include "./port.h"
#include "./round.h"
@@ -681,6 +681,12 @@ bool ReconstructTransformedHmtx(const uint8_t* transformed_buf,
return FONT_COMPRESSION_FAILURE();
}
+ // https://www.microsoft.com/typography/otspec/hmtx.htm
+ // "...only one entry need be in the array, but that entry is required."
+ if (PREDICT_FALSE(num_hmetrics < 1)) {
+ return FONT_COMPRESSION_FAILURE();
+ }
+
for (uint16_t i = 0; i < num_hmetrics; i++) {
uint16_t advance_width;
if (PREDICT_FALSE(!hmtx_buff_in.ReadU16(&advance_width))) {
@@ -739,7 +745,7 @@ bool Woff2Uncompress(uint8_t* dst_buf, size_t dst_size,
BrotliDecoderResult result = BrotliDecoderDecompress(
src_size, src_buf, &uncompressed_size, dst_buf);
if (PREDICT_FALSE(result != BROTLI_DECODER_RESULT_SUCCESS ||
- uncompressed_size != dst_size)) {
+ uncompressed_size != dst_size)) {
return FONT_COMPRESSION_FAILURE();
}
return true;
@@ -918,7 +924,10 @@ bool ReconstructFont(uint8_t* transformed_buf,
table.dst_offset = dest_offset;
checksum = ComputeULongSum(transformed_buf + table.src_offset,
table.src_length);
- out->Write(transformed_buf + table.src_offset, table.src_length);
+ if (PREDICT_FALSE(!out->Write(transformed_buf + table.src_offset,
+ table.src_length))) {
+ return FONT_COMPRESSION_FAILURE();
+ }
} else {
if (table.tag == kGlyfTableTag) {
table.dst_offset = dest_offset;
« no previous file with comments | « third_party/woff2/src/woff2_dec.h ('k') | third_party/woff2/src/woff2_enc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698