avoid crash with incomplete font definitions ( IcoMoon )
This commit is contained in:
parent
5c95cbd64a
commit
f96dc71b49
|
@ -50,6 +50,8 @@ namespace PostTableParser
|
|||
const auto from = reinterpret_cast< const uint8_t* >( glyphData + nglyphs );
|
||||
const auto to = reinterpret_cast< const uint8_t* >( blob.data() + blob.size() );
|
||||
|
||||
if ( to > from )
|
||||
{
|
||||
for ( auto s = from; s < to; s += *s + 1 )
|
||||
strings += s;
|
||||
|
||||
|
@ -57,10 +59,11 @@ namespace PostTableParser
|
|||
{
|
||||
const int idx = qFromBigEndian( glyphData[i] ) - 258;
|
||||
|
||||
if ( idx >= 0 )
|
||||
if ( idx >= 0 && idx < strings.size() )
|
||||
names.insert( toString( strings[idx] ), i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue