~ubuntu-branches/ubuntu/precise/libxfont/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/50_bdf_overflows.patch

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2007-04-11 15:52:11 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070411155211-6ed2v2akv5dq8uev
Tags: 1:1.2.8-1
* Add XS-Vcs-Browser to debian/control.
* New upstream release.
  + drop patch from 1:1.2.2-2, applied upstream.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: libxfont-1.2.7/src/bitmap/bdfread.c
2
 
===================================================================
3
 
--- libxfont-1.2.7.orig/src/bitmap/bdfread.c    2007-03-29 17:53:37.000000000 -0700
4
 
+++ libxfont-1.2.7/src/bitmap/bdfread.c 2007-03-29 17:53:54.000000000 -0700
5
 
@@ -65,6 +65,12 @@
6
 
 #include <X11/fonts/bitmap.h>
7
 
 #include <X11/fonts/bdfint.h>
8
 
 
9
 
+#if HAVE_STDINT_H
10
 
+#include <stdint.h>
11
 
+#elif !defined(INT32_MAX)
12
 
+#define INT32_MAX 0x7fffffff
13
 
+#endif
14
 
+
15
 
 #define INDICES 256
16
 
 #define MAXENCODING 0xFFFF
17
 
 #define BDFLINELEN  1024
18
 
@@ -288,6 +294,11 @@
19
 
        bdfError("invalid number of CHARS in BDF file\n");
20
 
        return (FALSE);
21
 
     }
22
 
+    if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
23
 
+       bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
24
 
+                sizeof(CharInfoRec));
25
 
+       goto BAILOUT;
26
 
+    }
27
 
     ci = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
28
 
     if (!ci) {
29
 
        bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
30
 
Index: libxfont-1.2.7/src/fontfile/fontdir.c
31
 
===================================================================
32
 
--- libxfont-1.2.7.orig/src/fontfile/fontdir.c  2007-03-29 17:53:37.000000000 -0700
33
 
+++ libxfont-1.2.7/src/fontfile/fontdir.c       2007-03-29 17:53:54.000000000 -0700
34
 
@@ -38,9 +38,17 @@
35
 
 #include    <X11/fonts/fntfilst.h>
36
 
 #include    <X11/keysym.h>
37
 
 
38
 
+#if HAVE_STDINT_H
39
 
+#include <stdint.h>
40
 
+#elif !defined(INT32_MAX)
41
 
+#define INT32_MAX 0x7fffffff
42
 
+#endif
43
 
+
44
 
 Bool
45
 
 FontFileInitTable (FontTablePtr table, int size)
46
 
 {
47
 
+    if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec))) 
48
 
+       return FALSE;
49
 
     if (size)
50
 
     {
51
 
        table->entries = (FontEntryPtr) xalloc(sizeof(FontEntryRec) * size);