|
|
cf1e18 |
From c578408c1fd4db09e4e3173f8a9e65c81cc187c1 Mon Sep 17 00:00:00 2001
|
|
|
cf1e18 |
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
cf1e18 |
Date: Fri, 25 Apr 2014 23:02:42 -0700
|
|
|
cf1e18 |
Subject: [PATCH 07/12] CVE-2014-0211: integer overflow in fs_read_extent_info()
|
|
|
cf1e18 |
|
|
|
cf1e18 |
fs_read_extent_info() parses a reply from the font server.
|
|
|
cf1e18 |
The reply contains a 32bit number of elements field which is used
|
|
|
cf1e18 |
to calculate a buffer length. There is an integer overflow in this
|
|
|
cf1e18 |
calculation which can lead to memory corruption.
|
|
|
cf1e18 |
|
|
|
cf1e18 |
Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
|
|
|
cf1e18 |
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
|
|
cf1e18 |
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
|
|
cf1e18 |
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
|
|
|
cf1e18 |
---
|
|
|
cf1e18 |
src/fc/fserve.c | 12 +++++++++++-
|
|
|
cf1e18 |
1 files changed, 11 insertions(+), 1 deletions(-)
|
|
|
cf1e18 |
|
|
|
cf1e18 |
diff --git a/src/fc/fserve.c b/src/fc/fserve.c
|
|
|
cf1e18 |
index ec5336e..96abd0e 100644
|
|
|
cf1e18 |
--- a/src/fc/fserve.c
|
|
|
cf1e18 |
+++ b/src/fc/fserve.c
|
|
|
cf1e18 |
@@ -70,6 +70,7 @@ in this Software without prior written authorization from The Open Group.
|
|
|
cf1e18 |
#include "fservestr.h"
|
|
|
cf1e18 |
#include <X11/fonts/fontutil.h>
|
|
|
cf1e18 |
#include <errno.h>
|
|
|
cf1e18 |
+#include <limits.h>
|
|
|
cf1e18 |
|
|
|
cf1e18 |
#include <time.h>
|
|
|
cf1e18 |
#define Time_t time_t
|
|
|
cf1e18 |
@@ -1050,7 +1051,16 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
|
|
|
cf1e18 |
numInfos *= 2;
|
|
|
cf1e18 |
haveInk = TRUE;
|
|
|
cf1e18 |
}
|
|
|
cf1e18 |
- ci = pCI = malloc(sizeof(CharInfoRec) * numInfos);
|
|
|
cf1e18 |
+ if (numInfos >= (INT_MAX / sizeof(CharInfoRec))) {
|
|
|
cf1e18 |
+#ifdef DEBUG
|
|
|
cf1e18 |
+ fprintf(stderr,
|
|
|
cf1e18 |
+ "fsQueryXExtents16: numInfos (%d) >= %ld\n",
|
|
|
cf1e18 |
+ numInfos, (INT_MAX / sizeof(CharInfoRec)));
|
|
|
cf1e18 |
+#endif
|
|
|
cf1e18 |
+ pCI = NULL;
|
|
|
cf1e18 |
+ }
|
|
|
cf1e18 |
+ else
|
|
|
cf1e18 |
+ pCI = malloc(sizeof(CharInfoRec) * numInfos);
|
|
|
cf1e18 |
|
|
|
cf1e18 |
if (!pCI)
|
|
|
cf1e18 |
{
|
|
|
cf1e18 |
--
|
|
|
cf1e18 |
1.7.1
|
|
|
cf1e18 |
|