Blame SOURCES/libxml2-CVE-2015-7497-Avoid-an-heap-buffer-overflow-in-xmlDictComputeFastQKey.patch

267d54
From 540a3b58c233db4f2d2becea9c2b79b3ce190055 Mon Sep 17 00:00:00 2001
267d54
From: David Drysdale <drysdale@google.com>
267d54
Date: Fri, 20 Nov 2015 10:47:12 +0800
267d54
Subject: [PATCH] CVE-2015-7497 Avoid an heap buffer overflow in
267d54
 xmlDictComputeFastQKey
267d54
To: libvir-list@redhat.com
267d54
267d54
For https://bugzilla.gnome.org/show_bug.cgi?id=756528
267d54
It was possible to hit a negative offset in the name indexing
267d54
used to randomize the dictionary key generation
267d54
Reported and fix provided by David Drysdale @ Google
267d54
267d54
Signed-off-by: Daniel Veillard <veillard@redhat.com>
267d54
---
267d54
 dict.c | 5 ++++-
267d54
 1 file changed, 4 insertions(+), 1 deletion(-)
267d54
267d54
diff --git a/dict.c b/dict.c
267d54
index 5f71d55..8c8f931 100644
267d54
--- a/dict.c
267d54
+++ b/dict.c
267d54
@@ -486,7 +486,10 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
267d54
 	value += 30 * (*prefix);
267d54
 
267d54
     if (len > 10) {
267d54
-        value += name[len - (plen + 1 + 1)];
267d54
+        int offset = len - (plen + 1 + 1);
267d54
+	if (offset < 0)
267d54
+	    offset = len - (10 + 1);
267d54
+	value += name[offset];
267d54
         len = 10;
267d54
 	if (plen > 10)
267d54
 	    plen = 10;
267d54
-- 
267d54
2.5.0
267d54