summaryrefslogtreecommitdiff
path: root/x11/libXfont/patches/patch-ab
blob: 84065b279fec19958dd02e84ef56f79ade398b3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$NetBSD: patch-ab,v 1.1 2007/04/03 20:27:21 drochner Exp $

--- src/fontfile/fontdir.c.orig	2007-04-03 19:04:16.000000000 +0200
+++ src/fontfile/fontdir.c
@@ -38,9 +38,17 @@ in this Software without prior written a
 #include    <X11/fonts/fntfilst.h>
 #include    <X11/keysym.h>
 
+#if HAVE_STDINT_H
+#include <stdint.h>
+#elif !defined(INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
+
 Bool
 FontFileInitTable (FontTablePtr table, int size)
 {
+    if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec)))
+	return FALSE;
     if (size)
     {
 	table->entries = (FontEntryPtr) xalloc(sizeof(FontEntryRec) * size);