From 3d1c57d5ef429e51ab7a626540c30b81e74a8f17 Mon Sep 17 00:00:00 2001
From: Reinhard Tartler <siretart@tauware.de>
Date: Mon, 10 Oct 2011 17:46:43 +0200
Subject: Imported nx-X11-3.1.0-4.tar.gz

Summary: Imported nx-X11-3.1.0-4.tar.gz
Keywords:

Imported nx-X11-3.1.0-4.tar.gz
into Git repository
---
 nx-X11/lib/font/bitmap/pcfread.c | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'nx-X11/lib/font')

diff --git a/nx-X11/lib/font/bitmap/pcfread.c b/nx-X11/lib/font/bitmap/pcfread.c
index dd76868bf..75916dae8 100644
--- a/nx-X11/lib/font/bitmap/pcfread.c
+++ b/nx-X11/lib/font/bitmap/pcfread.c
@@ -565,6 +565,9 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
     pFont->info.lastRow = pcfGetINT16(file, format);
     pFont->info.defaultCh = pcfGetINT16(file, format);
     if (IS_EOF(file)) goto Bail;
+    if (pFont->info.firstCol > pFont->info.lastCol ||
+       pFont->info.firstRow > pFont->info.lastRow ||
+       pFont->info.lastCol-pFont->info.firstCol > 255) goto Bail;
 
     nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
 	(pFont->info.lastRow - pFont->info.firstRow + 1);
@@ -703,6 +706,9 @@ pcfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
     pFontInfo->lastRow = pcfGetINT16(file, format);
     pFontInfo->defaultCh = pcfGetINT16(file, format);
     if (IS_EOF(file)) goto Bail;
+    if (pFontInfo->firstCol > pFontInfo->lastCol ||
+       pFontInfo->firstRow > pFontInfo->lastRow ||
+       pFontInfo->lastCol-pFontInfo->firstCol > 255) goto Bail;
 
     nencoding = (pFontInfo->lastCol - pFontInfo->firstCol + 1) *
 	(pFontInfo->lastRow - pFontInfo->firstRow + 1);
-- 
cgit v1.2.3