summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/expat-CVE-2015-1283-refix.patch
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-05-18 13:26:17 -0400
committerLeo Famulari <leo@famulari.name>2016-05-19 10:27:18 -0400
commit119b83989dd9edd1e8ba6cd379d159d024cbc61d (patch)
treeb94f92b990229fc5cebde7735f1545f22270c936 /gnu/packages/patches/expat-CVE-2015-1283-refix.patch
parent9684e30b9b597b93ae9c797ba8f3b40eff893ebe (diff)
downloadguix-patches-119b83989dd9edd1e8ba6cd379d159d024cbc61d.tar
guix-patches-119b83989dd9edd1e8ba6cd379d159d024cbc61d.tar.gz
gnu: expat: Fix CVE-2016-0718. Improve fix for CVE-2015-1283.
* gnu/packages/patches/expat-CVE-2015-1283-refix.patch, gnu/packages/patches/expat-CVE-2016-0718.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/xml.scm (expat)[replacement]: New field. (expat/fixed): New variable. [source]: Use new patches.
Diffstat (limited to 'gnu/packages/patches/expat-CVE-2015-1283-refix.patch')
-rw-r--r--gnu/packages/patches/expat-CVE-2015-1283-refix.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/gnu/packages/patches/expat-CVE-2015-1283-refix.patch b/gnu/packages/patches/expat-CVE-2015-1283-refix.patch
new file mode 100644
index 0000000000..af5e3bcc3e
--- /dev/null
+++ b/gnu/packages/patches/expat-CVE-2015-1283-refix.patch
@@ -0,0 +1,42 @@
+Update previous fix for CVE-2015-1283 to not rely on undefined behavior.
+
+Copied from Debian, as found in Debian package version 2.1.0-6+deb8u2.
+
+https://sources.debian.net/src/expat/2.1.0-6%2Bdeb8u2/debian/patches/CVE-2015-1283-refix.patch/
+
+From 29a11774d8ebbafe8418b4a5ffb4cc1160b194a1 Mon Sep 17 00:00:00 2001
+From: Pascal Cuoq <cuoq@trust-in-soft.com>
+Date: Sun, 15 May 2016 09:05:46 +0200
+Subject: [PATCH] Avoid relying on undefined behavior in CVE-2015-1283 fix.
+
+---
+ expat/lib/xmlparse.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/lib/xmlparse.c b/lib/xmlparse.c
+index 13e080d..cdb12ef 100644
+--- a/lib/xmlparse.c
++++ b/lib/xmlparse.c
+@@ -1695,7 +1695,8 @@ XML_GetBuffer(XML_Parser parser, int len
+ }
+
+ if (len > bufferLim - bufferEnd) {
+- int neededSize = len + (int)(bufferEnd - bufferPtr);
++ /* Do not invoke signed arithmetic overflow: */
++ int neededSize = (int) ((unsigned)len + (unsigned)(bufferEnd - bufferPtr));
+ /* BEGIN MOZILLA CHANGE (sanity check neededSize) */
+ if (neededSize < 0) {
+ errorCode = XML_ERROR_NO_MEMORY;
+@@ -1729,7 +1730,8 @@ XML_GetBuffer(XML_Parser parser, int len
+ if (bufferSize == 0)
+ bufferSize = INIT_BUFFER_SIZE;
+ do {
+- bufferSize *= 2;
++ /* Do not invoke signed arithmetic overflow: */
++ bufferSize = (int) (2U * (unsigned) bufferSize);
+ /* BEGIN MOZILLA CHANGE (prevent infinite loop on overflow) */
+ } while (bufferSize < neededSize && bufferSize > 0);
+ /* END MOZILLA CHANGE */
+--
+2.8.2
+