Commit bb7abd9d authored by Mike DePaulo's avatar Mike DePaulo Committed by Mike Gabriel

CVE-2014-0211: integer overflow in fs_read_extent_info() from xorg/lib/libXfont…

CVE-2014-0211: integer overflow in fs_read_extent_info() from xorg/lib/libXfont commit c578408c1fd4db09e4e3173f8a9e65c81cc187c1 fs_read_extent_info() parses a reply from the font server. The reply contains a 32bit number of elements field which is used to calculate a buffer length. There is an integer overflow in this calculation which can lead to memory corruption.
parent c6aebf92
...@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group. ...@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
#include "fservestr.h" #include "fservestr.h"
#include <X11/fonts/fontutil.h> #include <X11/fonts/fontutil.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <time.h> #include <time.h>
#define Time_t time_t #define Time_t time_t
...@@ -1060,7 +1061,16 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) ...@@ -1060,7 +1061,16 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec)
numInfos *= 2; numInfos *= 2;
haveInk = TRUE; haveInk = TRUE;
} }
ci = pCI = (CharInfoPtr) xalloc(sizeof(CharInfoRec) * numInfos); if (numInfos >= (INT_MAX / sizeof(CharInfoRec))) {
#ifdef DEBUG
fprintf(stderr,
"fsQueryXExtents16: numInfos (%d) >= %ld\n",
numInfos, (INT_MAX / sizeof(CharInfoRec)));
#endif
pCI = NULL;
}
else
pCI = malloc(sizeof(CharInfoRec) * numInfos);
if (!pCI) if (!pCI)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment