From 24c7b56a57f551db99f999cbd5815053b5c72408 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 14 Dec 2001 15:14:44 +0000 Subject: [PATCH] * src/truetype/ttgload.c (load_truetype_glyph): fixing crash when dealing with invalid fonts (i.e. glyph size < 10 bytes).. --- ChangeLog | 5 +++++ src/truetype/ttgload.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 29b3b6d98..47a2551d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-12-14 Scott Long + + * src/truetype/ttgload.c (load_truetype_glyph): fixing crash when dealing + with invalid fonts (i.e. glyph size < 10 bytes).. + 2001-12-14 Sam Latinga * builds/mac/freetype.mac: a new Makefile to build with MPW on MacOS diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 588ec41d8..0c5ee047e 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -723,6 +723,16 @@ if ( index < (FT_UInt)face->num_locations - 1 ) count = face->glyph_locations[index + 1] - offset; + /* temporary hack */ +#if 1 + if ( count < 10 ) + { + /* This glyph is corrupted -- it does not have a complete header */ + error = TT_Err_Invalid_Outline; + goto Fail; + } +#endif + if ( count == 0 ) { /* as described by Frederic Loyer, these are spaces, and */