Blame SOURCES/cve-2015-1802.patch

9950e3
From 2deda9906480f9c8ae07b8c2a5510cc7e4c59a8e Mon Sep 17 00:00:00 2001
9950e3
From: Alan Coopersmith <alan.coopersmith@oracle.com>
9950e3
Date: Fri, 6 Feb 2015 15:50:45 -0800
9950e3
Subject: bdfReadProperties: property count needs range check [CVE-2015-1802]
9950e3
9950e3
Avoid integer overflow or underflow when allocating memory arrays
9950e3
by multiplying the number of properties reported for a BDF font.
9950e3
9950e3
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
9950e3
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
9950e3
Reviewed-by: Julien Cristau <jcristau@debian.org>
9950e3
9950e3
diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c
9950e3
index 914a024..6387908 100644
9950e3
--- a/src/bitmap/bdfread.c
9950e3
+++ b/src/bitmap/bdfread.c
9950e3
@@ -604,7 +604,9 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
9950e3
 	bdfError("missing 'STARTPROPERTIES'\n");
9950e3
 	return (FALSE);
9950e3
     }
9950e3
-    if (sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) {
9950e3
+    if ((sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) ||
9950e3
+	(nProps <= 0) ||
9950e3
+	(nProps > ((INT32_MAX / sizeof(FontPropRec)) - BDF_GENPROPS))) {
9950e3
 	bdfError("bad 'STARTPROPERTIES'\n");
9950e3
 	return (FALSE);
9950e3
     }
9950e3
-- 
9950e3
cgit v0.10.2
9950e3