summaryrefslogtreecommitdiff
blob: 4c9a1adcb2fd1a4f0649242d4b278ab3a0808cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
--- vnc_unixsrc/Xvnc/lib/font/fontfile/fontdir.c.cve-2007-1351-1352	2000-06-11 06:00:53.000000000 -0600
+++ vnc_unixsrc/Xvnc/lib/font/fontfile/fontdir.c	2007-03-28 16:08:03.000000000 -0600
@@ -35,11 +35,19 @@ in this Software without prior written a
 #include    "fntfilst.h"
 #include    <X11/keysym.h>
 
+#if HAVE_STDINT_H
+#include <stdint.h>
+#elif !defined(INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
+	
 Bool
 FontFileInitTable (table, size)
     FontTablePtr    table;
     int		    size;
 {
+    if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec)))
+	return FALSE;
     if (size)
     {
 	table->entries = (FontEntryPtr) xalloc(sizeof(FontEntryRec) * size);
--- vnc_unixsrc/Xvnc/lib/font/bitmap/bdfread.c.cve-2007-1351-1352	2000-06-11 06:00:52.000000000 -0600
+++ vnc_unixsrc/Xvnc/lib/font/bitmap/bdfread.c	2007-03-28 16:06:06.000000000 -0600
@@ -59,6 +59,12 @@ from the X Consortium.
 #include "bitmap.h"
 #include "bdfint.h"
 
+#if HAVE_STDINT_H
+#include <stdint.h>
+#elif !defined(INT32_MAX)
+#define INT32_MAX 0x7fffffff
+#endif
+
 #define INDICES 256
 #define MAXENCODING 0xFFFF
 #define BDFLINELEN  1024
@@ -271,6 +277,11 @@ bdfReadCharacters(file, pFont, pState, b
 	bdfError("invalid number of CHARS in BDF file\n");
 	return (FALSE);
     }
+    if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
+	bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
+		 sizeof(CharInfoRec));
+	goto BAILOUT;
+    }
     ci = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
     if (!ci) {
 	bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,