forked from pool/expat
Dirk Mueller
2888ef8f38
- add expat-2.1.1-avoid_relying_on_undef_behaviour.patch to avoid relying on undefined behavior in CVE-2015-1283 fix [bnc#980391], [CVE-2015-1283] - add expat-2.1.1-parser_crashes_on_malformed_input.patch to fix Expat XML parser that mishandles certain kinds of malformed input documents [bnc#979441], [CVE-2016-0718] - use spec-cleaner to clean specfile OBS-URL: https://build.opensuse.org/request/show/396618 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/expat?expand=0&rev=47
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
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. It
|
|
does not really work: https://godbolt.org/g/Zl8gdF
|
|
|
|
---
|
|
expat/lib/xmlparse.c | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
Index: expat-2.1.1/lib/xmlparse.c
|
|
===================================================================
|
|
--- expat-2.1.1.orig/lib/xmlparse.c
|
|
+++ expat-2.1.1/lib/xmlparse.c
|
|
@@ -1693,7 +1693,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));
|
|
if (neededSize < 0) {
|
|
errorCode = XML_ERROR_NO_MEMORY;
|
|
return NULL;
|
|
@@ -1725,7 +1726,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);
|
|
} while (bufferSize < neededSize && bufferSize > 0);
|
|
if (bufferSize <= 0) {
|
|
errorCode = XML_ERROR_NO_MEMORY;
|