aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/fontfile/fontdir.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-06-08 15:07:46 +0200
committermarha <marha@users.sourceforge.net>2014-06-08 15:07:46 +0200
commitb5a2c971202ff19079cb5a98253d8760ae124d15 (patch)
tree451469af3bf1c7d9ce0236ba546867bbf6a2fb3a /libXfont/src/fontfile/fontdir.c
parent71cc8d9b7dc729934a29445cbd6d1f7a6d9ecbec (diff)
parentd435b20322433b335a4fc5693cce0399a3f27b2d (diff)
downloadvcxsrv-b5a2c971202ff19079cb5a98253d8760ae124d15.tar.gz
vcxsrv-b5a2c971202ff19079cb5a98253d8760ae124d15.tar.bz2
vcxsrv-b5a2c971202ff19079cb5a98253d8760ae124d15.zip
Merge remote-tracking branch 'origin/released'
Conflicts: X11/Xwindows.h
Diffstat (limited to 'libXfont/src/fontfile/fontdir.c')
-rw-r--r--libXfont/src/fontfile/fontdir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libXfont/src/fontfile/fontdir.c b/libXfont/src/fontfile/fontdir.c
index 13cda0a37..a4d41960b 100644
--- a/libXfont/src/fontfile/fontdir.c
+++ b/libXfont/src/fontfile/fontdir.c
@@ -179,6 +179,11 @@ FontFileAddEntry(FontTablePtr table, FontEntryPtr prototype)
if (table->sorted)
return (FontEntryPtr) 0; /* "cannot" happen */
if (table->used == table->size) {
+ if (table->size >= ((INT32_MAX / sizeof(FontEntryRec)) - 100))
+ /* If we've read so many entries we're going to ask for 2gb
+ or more of memory, something is so wrong with this font
+ directory that we should just give up before we overflow. */
+ return NULL;
newsize = table->size + 100;
entry = realloc(table->entries, newsize * sizeof(FontEntryRec));
if (!entry)