--- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1944,7 +1944,7 @@ short i, limit; FT_SubGlyph subglyph; - FT_Outline outline; + FT_Outline outline = { 0, 0, NULL, NULL, NULL, 0 }; FT_Vector* points = NULL; char* tags = NULL; short* contours = NULL; @@ -1953,6 +1953,13 @@ limit = (short)gloader->current.num_subglyphs; + /* make sure this isn't negative as we're going to add 4 later */ + if ( limit < 0 ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + /* construct an outline structure for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ outline.n_points = (short)( gloader->current.num_subglyphs + 4 );