0001-Fix-heap-overread-in-xsltFormatNumberConversion.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  10. ---
  11. Patch status: upstream commit eb1030de311
  12. libxslt/numbers.c | 3 ++-
  13. 1 file changed, 2 insertions(+), 1 deletion(-)
  14. diff --git a/libxslt/numbers.c b/libxslt/numbers.c
  15. index d1549b46ca26..e78c46b6357b 100644
  16. --- a/libxslt/numbers.c
  17. +++ b/libxslt/numbers.c
  18. @@ -1090,7 +1090,8 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
  19. }
  20. /* We have finished the integer part, now work on fraction */
  21. - if (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) {
  22. + if ( (*the_format != 0) &&
  23. + (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) ) {
  24. format_info.add_decimal = TRUE;
  25. the_format += xsltUTF8Size(the_format); /* Skip over the decimal */
  26. }
  27. --
  28. 2.10.2