Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 1 | From 69030714cde66d525a8884bda01b9e8f0abf8e1e Mon Sep 17 00:00:00 2001 |
| 2 | From: David Drysdale <drysdale@google.com> |
| 3 | Date: Fri, 20 Nov 2015 11:13:45 +0800 |
| 4 | Subject: [PATCH] CVE-2015-5312 Another entity expansion issue |
| 5 | |
| 6 | For https://bugzilla.gnome.org/show_bug.cgi?id=756733 |
| 7 | It is one case where the code in place to detect entities expansions |
| 8 | failed to exit when the situation was detected, leading to DoS |
| 9 | Problem reported by Kostya Serebryany @ Google |
| 10 | Patch provided by David Drysdale @ Google |
| 11 | |
| 12 | Upstream-Status: Backport |
| 13 | |
| 14 | CVE-2015-5312 |
| 15 | |
| 16 | Signed-off-by: Armin Kuster <akuster@mvista.com> |
| 17 | |
| 18 | --- |
| 19 | parser.c | 4 ++++ |
| 20 | 1 file changed, 4 insertions(+) |
| 21 | |
| 22 | diff --git a/parser.c b/parser.c |
| 23 | index b7b6668..da6e729 100644 |
| 24 | --- a/parser.c |
| 25 | +++ b/parser.c |
| 26 | @@ -2806,6 +2806,10 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, |
| 27 | 0, 0, 0); |
| 28 | ctxt->depth--; |
| 29 | |
| 30 | + if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || |
| 31 | + (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) |
| 32 | + goto int_error; |
| 33 | + |
| 34 | if (rep != NULL) { |
| 35 | current = rep; |
| 36 | while (*current != 0) { /* non input consuming loop */ |
| 37 | -- |
| 38 | 2.3.5 |
| 39 | |