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

« back to all changes in this revision

Viewing changes to debian/patches-freetype/CVE-2012-1143.patch

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-08-03 13:57:01 UTC
  • mfrom: (1.2.1) (34.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120803135701-ird6b33po0ygwadl
Tags: 2.4.10-0ubuntu1
* New upstream version
* debian/libfreetype6.symbols:
  - new version update
* debian/patches-freetype/savannah-bug-35847.patch,
  debian/patches-freetype/savannah-bug-35833.patch:
  - dropped, the fixes are in the new version
* Resynchronize on Debian, remaining diff:
* debian/patches-freetype/revert_scalable_fonts_metric.patch:
  - revert commit "Fix metrics on size request for scalable fonts.",
    it's breaking gtk underlining markups and creating some other 
    issues as well (lp: #972223)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Fix divide by zero checks when casting to 32 bit ints
2
 
Origin: upstream, http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=ba67957d5ead443f4b6b31805d6e780d54361ca4
3
 
 
4
 
Index: freetype-2.4.8/src/base/ftcalc.c
5
 
===================================================================
6
 
--- freetype-2.4.8.orig/src/base/ftcalc.c       2009-07-31 11:45:18.000000000 -0500
7
 
+++ freetype-2.4.8/src/base/ftcalc.c    2012-03-20 15:48:23.200375064 -0500
8
 
@@ -307,7 +307,7 @@
9
 
       q <<= 1;
10
 
       r  |= lo >> 31;
11
 
 
12
 
-      if ( r >= (FT_UInt32)y )
13
 
+      if ( r >= y )
14
 
       {
15
 
         r -= y;
16
 
         q |= 1;
17
 
@@ -373,7 +373,7 @@
18
 
     if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
19
 
       a = ( a * b + ( c >> 1 ) ) / c;
20
 
 
21
 
-    else if ( c > 0 )
22
 
+    else if ( (FT_Int32)c > 0 )
23
 
     {
24
 
       FT_Int64  temp, temp2;
25
 
 
26
 
@@ -412,7 +412,7 @@
27
 
     if ( a <= 46340L && b <= 46340L && c > 0 )
28
 
       a = a * b / c;
29
 
 
30
 
-    else if ( c > 0 )
31
 
+    else if ( (FT_Int32)c > 0 )
32
 
     {
33
 
       FT_Int64  temp;
34
 
 
35
 
@@ -544,7 +544,7 @@
36
 
     s  = (FT_Int32)a; a = FT_ABS( a );
37
 
     s ^= (FT_Int32)b; b = FT_ABS( b );
38
 
 
39
 
-    if ( b == 0 )
40
 
+    if ( (FT_UInt32)b == 0 )
41
 
     {
42
 
       /* check for division by 0 */
43
 
       q = (FT_UInt32)0x7FFFFFFFL;
44
 
@@ -552,15 +552,16 @@
45
 
     else if ( ( a >> 16 ) == 0 )
46
 
     {
47
 
       /* compute result directly */
48
 
-      q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b;
49
 
+      q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b;
50
 
     }
51
 
     else
52
 
     {
53
 
       /* we need more bits; we have to do it by hand */
54
 
       FT_Int64  temp, temp2;
55
 
 
56
 
-      temp.hi  = (FT_Int32) (a >> 16);
57
 
-      temp.lo  = (FT_UInt32)(a << 16);
58
 
+
59
 
+      temp.hi  = (FT_Int32) ( a >> 16 );
60
 
+      temp.lo  = (FT_UInt32)( a << 16 );
61
 
       temp2.hi = 0;
62
 
       temp2.lo = (FT_UInt32)( b >> 1 );
63
 
       FT_Add64( &temp, &temp2, &temp );