xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-2.9.1-CVE-2017-18258.patch

83ebca
From e2a9122b8dde53d320750451e9907a7dcb2ca8bb Mon Sep 17 00:00:00 2001
83ebca
From: Nick Wellnhofer <wellnhofer@aevum.de>
83ebca
Date: Thu, 7 Sep 2017 18:36:01 +0200
83ebca
Subject: [PATCH] Set memory limit for LZMA decompression
83ebca
83ebca
Otherwise malicious LZMA compressed files could consume large amounts
83ebca
of memory when decompressed.
83ebca
83ebca
According to the xz man page, files compressed with `xz -9` currently
83ebca
require 65 MB to decompress, so set the limit to 100 MB.
83ebca
83ebca
Should fix bug 786696.
83ebca
---
83ebca
 xzlib.c | 2 +-
83ebca
 1 file changed, 1 insertion(+), 1 deletion(-)
83ebca
83ebca
diff --git a/xzlib.c b/xzlib.c
83ebca
index 782957f6..f43632bd 100644
83ebca
--- a/xzlib.c
83ebca
+++ b/xzlib.c
83ebca
@@ -408,7 +408,7 @@ xz_head(xz_statep state)
83ebca
         state->strm = init;
83ebca
         state->strm.avail_in = 0;
83ebca
         state->strm.next_in = NULL;
83ebca
-        if (lzma_auto_decoder(&state->strm, UINT64_MAX, 0) != LZMA_OK) {
83ebca
+        if (lzma_auto_decoder(&state->strm, 100000000, 0) != LZMA_OK) {
83ebca
             xmlFree(state->out);
83ebca
             xmlFree(state->in);
83ebca
             state->size = 0;
83ebca
-- 
83ebca
2.22.0
83ebca