From 0f6f367ec1a8ae01311523ceb8029b754b8b2945 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 4 Jul 2007 19:57:45 +0000 Subject: [PATCH] Better maxComponentDepth test. --- src/truetype/ttgload.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 29736abc0..d63fb99d5 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1084,9 +1084,10 @@ #endif - /* some fonts haven't this field set correctly, */ - /* thus we add 1 to catch the majority of them */ - if ( recurse_count > (FT_UInt)face->max_profile.maxComponentDepth + 1 ) + /* some fonts have an incorrect value of `maxComponentDepth', */ + /* thus we allow depth 1 to catch the majority of them */ + if ( recurse_count > 1 && + recurse_count > face->max_profile.maxComponentDepth ) { error = TT_Err_Invalid_Composite; goto Exit;