From 22e984b20052abf5730af59e226f06919c3aa73c Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 15 May 2013 22:50:50 -0400 Subject: [PATCH] Fix #2016: reading memory past the end of a C++ std::vector --- ttconv/pprdrv_tt2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ttconv/pprdrv_tt2.cpp b/ttconv/pprdrv_tt2.cpp index b3fc4b3ae14a..2643afa09930 100644 --- a/ttconv/pprdrv_tt2.cpp +++ b/ttconv/pprdrv_tt2.cpp @@ -700,7 +700,7 @@ void ttfont_add_glyph_dependencies(struct TTFONT *font, std::vector& glyph_ std::vector::iterator insertion = std::lower_bound(glyph_ids.begin(), glyph_ids.end(), gind); - if (*insertion != gind) + if (insertion == glyph_ids.end() || *insertion != gind) { glyph_ids.insert(insertion, gind); glyph_stack.push(gind);