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-2010-1797.patch 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. --- freetype-2.3.11/src/cff/cffgload.c.CVE-2010-1797-2 2009-09-10 17:52:21.000000000 +0200
  2. +++ freetype-2.3.11/src/cff/cffgload.c 2010-08-11 13:39:32.000000000 +0200
  3. @@ -2358,8 +2358,11 @@
  4. return CFF_Err_Unimplemented_Feature;
  5. }
  6. - decoder->top = args;
  7. + decoder->top = args;
  8. + if ( decoder->top - stack >= CFF_MAX_OPERANDS )
  9. + goto Stack_Overflow;
  10. +
  11. } /* general operator processing */
  12. } /* while ip < limit */
  13. @@ -2627,48 +2630,54 @@
  14. /* now load the unscaled outline */
  15. error = cff_get_glyph_data( face, glyph_index,
  16. &charstring, &charstring_len );
  17. - if ( !error )
  18. - {
  19. - error = cff_decoder_prepare( &decoder, size, glyph_index );
  20. - if ( !error )
  21. - {
  22. - error = cff_decoder_parse_charstrings( &decoder,
  23. - charstring,
  24. - charstring_len );
  25. + if ( error )
  26. + goto Glyph_Build_Finished;
  27. +
  28. + error = cff_decoder_prepare( &decoder, size, glyph_index );
  29. + if ( error )
  30. + goto Glyph_Build_Finished;
  31. - cff_free_glyph_data( face, &charstring, charstring_len );
  32. + error = cff_decoder_parse_charstrings( &decoder,
  33. + charstring,
  34. + charstring_len );
  35. +
  36. + cff_free_glyph_data( face, &charstring, charstring_len );
  37. +
  38. + if ( error )
  39. + goto Glyph_Build_Finished;
  40. #ifdef FT_CONFIG_OPTION_INCREMENTAL
  41. - /* Control data and length may not be available for incremental */
  42. - /* fonts. */
  43. - if ( face->root.internal->incremental_interface )
  44. - {
  45. - glyph->root.control_data = 0;
  46. - glyph->root.control_len = 0;
  47. - }
  48. - else
  49. + /* Control data and length may not be available for incremental */
  50. + /* fonts. */
  51. + if ( face->root.internal->incremental_interface )
  52. + {
  53. + glyph->root.control_data = 0;
  54. + glyph->root.control_len = 0;
  55. + }
  56. + else
  57. #endif /* FT_CONFIG_OPTION_INCREMENTAL */
  58. - /* We set control_data and control_len if charstrings is loaded. */
  59. - /* See how charstring loads at cff_index_access_element() in */
  60. - /* cffload.c. */
  61. - {
  62. - CFF_Index csindex = &cff->charstrings_index;
  63. + /* We set control_data and control_len if charstrings is loaded. */
  64. + /* See how charstring loads at cff_index_access_element() in */
  65. + /* cffload.c. */
  66. + {
  67. + CFF_Index csindex = &cff->charstrings_index;
  68. - if ( csindex->offsets )
  69. - {
  70. - glyph->root.control_data = csindex->bytes +
  71. - csindex->offsets[glyph_index] - 1;
  72. - glyph->root.control_len = charstring_len;
  73. - }
  74. - }
  75. + if ( csindex->offsets )
  76. + {
  77. + glyph->root.control_data = csindex->bytes +
  78. + csindex->offsets[glyph_index] - 1;
  79. + glyph->root.control_len = charstring_len;
  80. }
  81. }
  82. - /* save new glyph tables */
  83. - cff_builder_done( &decoder.builder );
  84. + Glyph_Build_Finished:
  85. + /* save new glyph tables, if no error */
  86. + if ( !error )
  87. + cff_builder_done( &decoder.builder );
  88. + /* XXX: anything to do for broken glyph entry? */
  89. }
  90. #ifdef FT_CONFIG_OPTION_INCREMENTAL