You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

freetype-2.3.11-CVE-2012-1143.patch 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --- freetype-2.3.11/src/base/ftcalc.c 2009-07-31 18:45:18.000000000 +0200
  2. +++ freetype-2.3.11/src/base/ftcalc.c 2012-03-28 11:59:17.000000000 +0200
  3. @@ -4,7 +4,7 @@
  4. /* */
  5. /* Arithmetic computations (body). */
  6. /* */
  7. -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */
  8. +/* Copyright 1996-2006, 2008, 2012 by */
  9. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  10. /* */
  11. /* This file is part of the FreeType project, and may only be used, */
  12. @@ -307,7 +307,7 @@
  13. q <<= 1;
  14. r |= lo >> 31;
  15. - if ( r >= (FT_UInt32)y )
  16. + if ( r >= y )
  17. {
  18. r -= y;
  19. q |= 1;
  20. @@ -373,7 +373,7 @@
  21. if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
  22. a = ( a * b + ( c >> 1 ) ) / c;
  23. - else if ( c > 0 )
  24. + else if ( (FT_Int32)c > 0 )
  25. {
  26. FT_Int64 temp, temp2;
  27. @@ -412,7 +412,7 @@
  28. if ( a <= 46340L && b <= 46340L && c > 0 )
  29. a = a * b / c;
  30. - else if ( c > 0 )
  31. + else if ( (FT_Int32)c > 0 )
  32. {
  33. FT_Int64 temp;
  34. @@ -544,7 +544,7 @@
  35. s = (FT_Int32)a; a = FT_ABS( a );
  36. s ^= (FT_Int32)b; b = FT_ABS( b );
  37. - if ( b == 0 )
  38. + if ( (FT_UInt32)b == 0 )
  39. {
  40. /* check for division by 0 */
  41. q = (FT_UInt32)0x7FFFFFFFL;
  42. @@ -552,15 +552,16 @@
  43. else if ( ( a >> 16 ) == 0 )
  44. {
  45. /* compute result directly */
  46. - q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b;
  47. + q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b;
  48. }
  49. else
  50. {
  51. /* we need more bits; we have to do it by hand */
  52. FT_Int64 temp, temp2;
  53. - temp.hi = (FT_Int32) (a >> 16);
  54. - temp.lo = (FT_UInt32)(a << 16);
  55. +
  56. + temp.hi = (FT_Int32) ( a >> 16 );
  57. + temp.lo = (FT_UInt32)( a << 16 );
  58. temp2.hi = 0;
  59. temp2.lo = (FT_UInt32)( b >> 1 );
  60. FT_Add64( &temp, &temp2, &temp );