* src/cid/cidgload.c (cid_load_glyph): Fortify incremental loading.

This commit is contained in:
Alexei Podtelezhnikov 2021-10-07 22:43:12 -04:00
parent 22befeef82
commit 0313a11c4c
1 changed files with 5 additions and 8 deletions

View File

@ -76,20 +76,17 @@
error = inc->funcs->get_glyph_data( inc->object, error = inc->funcs->get_glyph_data( inc->object,
glyph_index, &glyph_data ); glyph_index, &glyph_data );
if ( error ) if ( error || glyph_data.length < cid->fd_bytes )
goto Exit; goto Exit;
p = (FT_Byte*)glyph_data.pointer; p = (FT_Byte*)glyph_data.pointer;
fd_select = cid_get_offset( &p, cid->fd_bytes ); fd_select = cid_get_offset( &p, cid->fd_bytes );
if ( glyph_data.length != 0 )
{
glyph_length = glyph_data.length - cid->fd_bytes; glyph_length = glyph_data.length - cid->fd_bytes;
if ( !FT_QALLOC( charstring, glyph_length ) ) if ( !FT_QALLOC( charstring, glyph_length ) )
FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes, FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
glyph_length ); glyph_length );
}
inc->funcs->free_glyph_data( inc->object, &glyph_data ); inc->funcs->free_glyph_data( inc->object, &glyph_data );