diff options
Diffstat (limited to 'Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp')
-rw-r--r-- | Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp b/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp index ae9035d1d4b..b521d5e5a93 100644 --- a/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp +++ b/Build/source/libs/graphite2/graphite2-src/src/GlyphCache.cpp @@ -211,6 +211,8 @@ GlyphCache::~GlyphCache() const GlyphFace *GlyphCache::glyph(unsigned short glyphid) const //result may be changed by subsequent call with a different glyphid { + if (glyphid >= numGlyphs()) + return _glyphs[0]; const GlyphFace * & p = _glyphs[glyphid]; if (p == 0 && _glyph_loader) { @@ -389,12 +391,14 @@ const GlyphFace * GlyphCache::Loader::read_glyph(unsigned short glyphid, GlyphFa gloce = be::peek<uint16>(gloc); } - if (glocs + 1 >= m_pGlat.size() || gloce > m_pGlat.size()) + if (glocs >= m_pGlat.size() - 1 || gloce > m_pGlat.size()) return 0; const uint32 glat_version = be::peek<uint32>(m_pGlat); if (glat_version >= 0x00030000) { + if (glocs >= gloce) + return 0; const byte * p = m_pGlat + glocs; uint16 bmap = be::read<uint16>(p); int num = bit_set_count((uint32)bmap); |