From e82199121f643cbe40ad3f3c3a6c0c2611794323 Mon Sep 17 00:00:00 2001 From: Huw D M Davies Date: Thu, 10 Dec 1998 08:26:23 +0000 Subject: [PATCH] Sanity check on font size. --- graphics/x11drv/xfont.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 46132b35840..f54ac79f463 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -32,6 +32,8 @@ #define MAX_FONT_FAMILIES 128 #define MAX_LFD_LENGTH 256 +#define MAX_FONT_SIZE 5000 /* Max size in pixels */ + #define REMOVE_SUBSETS 1 #define UNMARK_SUBSETS 0 @@ -2225,6 +2227,13 @@ static X_PHYSFONT XFONT_RealizeFont( LPLOGFONT16 plf ) plf->lfCharSet, plf->lfFaceName, plf->lfHeight, plf->lfWeight, (plf->lfItalic) ? "Italic" : "" ); + if(abs(plf->lfHeight) > MAX_FONT_SIZE) { + ERR(font, + "plf->lfHeight = %d, this is probably not right. Setting to 100\n", + plf->lfHeight); + plf->lfHeight = 100; + } + XFONT_MatchDeviceFont( fontList, &fm ); pfo->fr = fm.pfr;