aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <leizleiz@users.noreply.github.com>2016-10-19 14:44:47 -0700
committerLei Zhang <leizleiz@users.noreply.github.com>2016-10-19 14:44:47 -0700
commit6d1efaa8a89ea563247747e99faf0c44e35842d3 (patch)
tree6ab869272d86a5facfd022b6ab737f991af6790f
parentcafc4c869b7ca3d35ea1e7a4cc97b9aeb69ea538 (diff)
downloadsfntly-6d1efaa8a89ea563247747e99faf0c44e35842d3.tar.gz
Fix out of bound access in subtly sample program.
Fixes https://crbug.com/638573
-rw-r--r--cpp/src/sample/subtly/font_assembler.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/cpp/src/sample/subtly/font_assembler.cc b/cpp/src/sample/subtly/font_assembler.cc
index 2f7cd11..4717512 100644
--- a/cpp/src/sample/subtly/font_assembler.cc
+++ b/cpp/src/sample/subtly/font_assembler.cc
@@ -211,6 +211,8 @@ bool FontAssembler::AssembleGlyphAndLocaTables() {
// If there are missing glyphs between the last glyph_id and the
// current resolved_glyph_id, since the LOCA table needs to have the same
// size, the offset is kept the same.
+ loca_list.resize(std::max(loca_list.size(),
+ static_cast<size_t>(resolved_glyph_id + 2)));
for (int32_t i = last_glyph_id + 1; i <= resolved_glyph_id; ++i)
loca_list[i] = last_offset;
last_offset += length;