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-2011-3439.patch 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. --- freetype-2.3.11/src/cid/cidload.c 2009-07-03 15:28:24.000000000 +0200
  2. +++ freetype-2.3.11/src/cid/cidload.c 2011-11-15 12:58:41.000000000 +0100
  3. @@ -4,7 +4,7 @@
  4. /* */
  5. /* CID-keyed Type1 font loader (body). */
  6. /* */
  7. -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */
  8. +/* Copyright 1996-2006, 2009, 2011 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. @@ -110,7 +110,7 @@
  13. CID_FaceDict dict;
  14. - if ( parser->num_dict < 0 )
  15. + if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts )
  16. {
  17. FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n",
  18. keyword->ident ));
  19. @@ -158,7 +158,7 @@
  20. FT_Fixed temp_scale;
  21. - if ( parser->num_dict >= 0 )
  22. + if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
  23. {
  24. dict = face->cid.font_dicts + parser->num_dict;
  25. matrix = &dict->font_matrix;
  26. @@ -249,7 +249,7 @@
  27. CID_FaceDict dict;
  28. - if ( parser->num_dict >= 0 )
  29. + if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
  30. {
  31. dict = face->cid.font_dicts + parser->num_dict;
  32. @@ -413,12 +413,25 @@
  33. FT_Byte* p;
  34. + /* Check for possible overflow. */
  35. + if ( num_subrs == FT_UINT_MAX )
  36. + {
  37. + error = CID_Err_Syntax_Error;
  38. + goto Fail;
  39. + }
  40. +
  41. /* reallocate offsets array if needed */
  42. if ( num_subrs + 1 > max_offsets )
  43. {
  44. FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 );
  45. + if ( new_max <= max_offsets )
  46. + {
  47. + error = CID_Err_Syntax_Error;
  48. + goto Fail;
  49. + }
  50. +
  51. if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
  52. goto Fail;
  53. @@ -436,6 +449,11 @@
  54. FT_FRAME_EXIT();
  55. + /* offsets must be ordered */
  56. + for ( count = 1; count <= num_subrs; count++ )
  57. + if ( offsets[count - 1] > offsets[count] )
  58. + goto Fail;
  59. +
  60. /* now, compute the size of subrs charstrings, */
  61. /* allocate, and read them */
  62. data_len = offsets[num_subrs] - offsets[0];