From 2bc6acf6dfa2f6dd2f8da63b4fe2e27851e45e11 Mon Sep 17 00:00:00 2001 From: Rod Sheeter Date: Thu, 21 Apr 2016 09:29:50 -0700 Subject: [PATCH] Push fix for https://bugs.chromium.org/p/chromium/issues/detail?id=604649 --- src/woff2_dec.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/woff2_dec.cc b/src/woff2_dec.cc index ef242cc..1e63caa 100644 --- a/src/woff2_dec.cc +++ b/src/woff2_dec.cc @@ -603,13 +603,12 @@ bool ReconstructGlyf(const uint8_t* data, Table* glyf_table, *glyf_checksum += ComputeULongSum(glyph_buf.get(), glyph_size); // We may need x_min to reconstruct 'hmtx' - Buffer x_min_buf(glyph_buf.get() + 2, 2); - int16_t x_min; - if (PREDICT_FALSE(!x_min_buf.ReadS16(&x_min))) { - return FONT_COMPRESSION_FAILURE(); + if (n_contours > 0) { + Buffer x_min_buf(glyph_buf.get() + 2, 2); + if (PREDICT_FALSE(!x_min_buf.ReadS16(&info->x_mins[i]))) { + return FONT_COMPRESSION_FAILURE(); + } } - - info->x_mins[i] = n_contours != 0 ? x_min : 0; } // glyf_table dst_offset was set by ReconstructFont