Package: libxslt / 1.1.32-2.2~deb10u1

0008-Fix-uninitialized-read-with-UTF-8-grouping-chars.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Mon, 3 Jun 2019 13:14:45 +0200
Subject: Fix uninitialized read with UTF-8 grouping chars
Origin: https://gitlab.gnome.org/GNOME/libxslt/commit/6ce8de69330783977dd14f6569419489875fb71b
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2019-13118
Bug-Debian: https://bugs.debian.org/931320
Bug-Debian: https://bugs.debian.org/933743

The character type in xsltFormatNumberConversion was too narrow and
an invalid character/length combination could be passed to
xsltNumberFormatDecimal, resulting in an uninitialized read.

Found by OSS-Fuzz.
---
 libxslt/numbers.c         | 5 +++--
 tests/docs/bug-222.xml    | 1 +
 tests/general/bug-222.out | 2 ++
 tests/general/bug-222.xsl | 6 ++++++
 4 files changed, 12 insertions(+), 2 deletions(-)
 create mode 100644 tests/docs/bug-222.xml
 create mode 100644 tests/general/bug-222.out
 create mode 100644 tests/general/bug-222.xsl

diff --git a/libxslt/numbers.c b/libxslt/numbers.c
index f1ed88468257..20b99d5adef0 100644
--- a/libxslt/numbers.c
+++ b/libxslt/numbers.c
@@ -1298,13 +1298,14 @@ OUTPUT_NUMBER:
     number = floor((scale * number + 0.5)) / scale;
     if ((self->grouping != NULL) &&
         (self->grouping[0] != 0)) {
+        int gchar;
 
 	len = xmlStrlen(self->grouping);
-	pchar = xsltGetUTF8Char(self->grouping, &len);
+	gchar = xsltGetUTF8Char(self->grouping, &len);
 	xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
 				format_info.integer_digits,
 				format_info.group,
-				pchar, len);
+				gchar, len);
     } else
 	xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0],
 				format_info.integer_digits,
diff --git a/tests/docs/bug-222.xml b/tests/docs/bug-222.xml
new file mode 100644
index 000000000000..69d62f2c9aef
--- /dev/null
+++ b/tests/docs/bug-222.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/general/bug-222.out b/tests/general/bug-222.out
new file mode 100644
index 000000000000..e3139698eb49
--- /dev/null
+++ b/tests/general/bug-222.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+1⠢0
diff --git a/tests/general/bug-222.xsl b/tests/general/bug-222.xsl
new file mode 100644
index 000000000000..e32dc47337cb
--- /dev/null
+++ b/tests/general/bug-222.xsl
@@ -0,0 +1,6 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:decimal-format name="f" grouping-separator="⠢"/>
+  <xsl:template match="/">
+    <xsl:value-of select="format-number(10,'#⠢0','f')"/>
+  </xsl:template>
+</xsl:stylesheet>
-- 
2.20.1