~ubuntu-branches/ubuntu/trusty/freetype/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches-freetype/CVE-2014-96xx/CVE-2014-9669.patch

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-02-24 09:06:36 UTC
  • mfrom: (58.1.3 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20150224090636-g33bld4l95n7l3fv
Tags: 2.5.2-1ubuntu2.4
* SECURITY UPDATE: denial of service and possible code execution via
  multiple security issues
  - debian/patches-freetype/CVE-2014-96xx/*.patch: backport a large
    quantity of upstream commits to fix multiple security issues.
  - CVE-2014-9656
  - CVE-2014-9657
  - CVE-2014-9658
  - CVE-2014-9659
  - CVE-2014-9660
  - CVE-2014-9661
  - CVE-2014-9662
  - CVE-2014-9663
  - CVE-2014-9664
  - CVE-2014-9665
  - CVE-2014-9666
  - CVE-2014-9667
  - CVE-2014-9668
  - CVE-2014-9669
  - CVE-2014-9670
  - CVE-2014-9671
  - CVE-2014-9672
  - CVE-2014-9673
  - CVE-2014-9674
  - CVE-2014-9675

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Backport of:
 
2
 
 
3
From 602040b1112c9f94d68e200be59ea7ac3d104565 Mon Sep 17 00:00:00 2001
 
4
From: Werner Lemberg <wl@gnu.org>
 
5
Date: Wed, 12 Nov 2014 19:51:20 +0000
 
6
Subject: [sfnt] Fix Savannah bug #43588.
 
7
 
 
8
* src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate,
 
9
tt_cmap12_validate, tt_cmap13_validate, tt_cmap14_validate): Protect
 
10
against overflow in additions and multiplications.
 
11
---
 
12
Index: freetype-2.5.2/src/sfnt/ttcmap.c
 
13
===================================================================
 
14
--- freetype-2.5.2.orig/src/sfnt/ttcmap.c       2015-02-24 08:26:48.072062380 -0500
 
15
+++ freetype-2.5.2/src/sfnt/ttcmap.c    2015-02-24 08:26:48.068062354 -0500
 
16
@@ -1649,7 +1649,8 @@
 
17
     p          = is32  + 8192;          /* skip `is32' array */
 
18
     num_groups = TT_NEXT_ULONG( p );
 
19
 
 
20
-    if ( p + num_groups * 12 > valid->limit )
 
21
+    /* p + num_groups * 12 > valid->limit ? */
 
22
+    if ( num_groups > (FT_UInt32)( valid->limit - p ) / 12 )
 
23
       FT_INVALID_TOO_SHORT;
 
24
 
 
25
     /* check groups, they must be in increasing order */
 
26
@@ -1674,7 +1675,12 @@
 
27
 
 
28
         if ( valid->level >= FT_VALIDATE_TIGHT )
 
29
         {
 
30
-          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )
 
31
+          FT_UInt32  d = end - start;
 
32
+
 
33
+
 
34
+          /* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
 
35
+          if ( d > TT_VALID_GLYPH_COUNT( valid )             ||
 
36
+               start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
 
37
             FT_INVALID_GLYPH_ID;
 
38
 
 
39
           count = (FT_UInt32)( end - start + 1 );
 
40
@@ -1872,7 +1878,9 @@
 
41
     count  = TT_NEXT_ULONG( p );
 
42
 
 
43
     if ( length > (FT_ULong)( valid->limit - table ) ||
 
44
-         length < 20 + count * 2                     )
 
45
+         /* length < 20 + count * 2 ? */
 
46
+         length < 20                                 ||
 
47
+         ( length - 20 ) / 2 < count                 )
 
48
       FT_INVALID_TOO_SHORT;
 
49
 
 
50
     /* check glyph indices */
 
51
@@ -2059,7 +2067,9 @@
 
52
     num_groups = TT_NEXT_ULONG( p );
 
53
 
 
54
     if ( length > (FT_ULong)( valid->limit - table ) ||
 
55
-         length < 16 + 12 * num_groups               )
 
56
+         /* length < 16 + 12 * num_groups ? */
 
57
+         length < 16                                 ||
 
58
+         ( length - 16 ) / 12 < num_groups           )
 
59
       FT_INVALID_TOO_SHORT;
 
60
 
 
61
     /* check groups, they must be in increasing order */
 
62
@@ -2081,7 +2091,12 @@
 
63
 
 
64
         if ( valid->level >= FT_VALIDATE_TIGHT )
 
65
         {
 
66
-          if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) )
 
67
+          FT_UInt32  d = end - start;
 
68
+
 
69
+
 
70
+          /* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
 
71
+          if ( d > TT_VALID_GLYPH_COUNT( valid )             ||
 
72
+               start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
 
73
             FT_INVALID_GLYPH_ID;
 
74
         }
 
75
 
 
76
@@ -2383,7 +2398,9 @@
 
77
     num_groups = TT_NEXT_ULONG( p );
 
78
 
 
79
     if ( length > (FT_ULong)( valid->limit - table ) ||
 
80
-         length < 16 + 12 * num_groups               )
 
81
+         /* length < 16 + 12 * num_groups ? */
 
82
+         length < 16                                 ||
 
83
+         ( length - 16 ) / 12 < num_groups           )
 
84
       FT_INVALID_TOO_SHORT;
 
85
 
 
86
     /* check groups, they must be in increasing order */
 
87
@@ -2764,7 +2781,9 @@
 
88
 
 
89
 
 
90
     if ( length > (FT_ULong)( valid->limit - table ) ||
 
91
-         length < 10 + 11 * num_selectors            )
 
92
+         /* length < 10 + 11 * num_selectors ? */
 
93
+         length < 10                                 ||
 
94
+         ( length - 10 ) / 11 < num_selectors        )
 
95
       FT_INVALID_TOO_SHORT;
 
96
 
 
97
     /* check selectors, they must be in increasing order */
 
98
@@ -2800,7 +2819,8 @@
 
99
           FT_ULong  lastBase  = 0;
 
100
 
 
101
 
 
102
-          if ( defp + numRanges * 4 > valid->limit )
 
103
+          /* defp + numRanges * 4 > valid->limit ? */
 
104
+          if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 )
 
105
             FT_INVALID_TOO_SHORT;
 
106
 
 
107
           for ( i = 0; i < numRanges; ++i )
 
108
@@ -2827,7 +2847,8 @@
 
109
           FT_ULong  i, lastUni  = 0;
 
110
 
 
111
 
 
112
-          if ( numMappings * 4 > (FT_ULong)( valid->limit - ndp ) )
 
113
+          /* numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ? */
 
114
+          if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 4 )
 
115
             FT_INVALID_TOO_SHORT;
 
116
 
 
117
           for ( i = 0; i < numMappings; ++i )