0020-Fix-heap-overread-in-xsltFormatNumberConversion.patch 953 B

1234567891011121314151617181920212223242526
  1. From eb1030de31165b68487f288308f9d1810fed6880 Mon Sep 17 00:00:00 2001
  2. From: Nick Wellnhofer <wellnhofer@aevum.de>
  3. Date: Fri, 10 Jun 2016 14:23:58 +0200
  4. Subject: [PATCH] Fix heap overread in xsltFormatNumberConversion
  5. An empty decimal-separator could cause a heap overread. This can be
  6. exploited to leak a couple of bytes after the buffer that holds the
  7. pattern string.
  8. Found with afl-fuzz and ASan.
  9. ---
  10. libxslt/numbers.c | 3 ++-
  11. 1 file changed, 2 insertions(+), 1 deletion(-)
  12. --- a/libxslt/numbers.c
  13. +++ b/libxslt/numbers.c
  14. @@ -1109,7 +1109,8 @@ xsltFormatNumberConversion(xsltDecimalFo
  15. }
  16. /* We have finished the integer part, now work on fraction */
  17. - if (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) {
  18. + if ( (*the_format != 0) &&
  19. + (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) ) {
  20. format_info.add_decimal = TRUE;
  21. the_format += xsltUTF8Size(the_format); /* Skip over the decimal */
  22. }