1 From 90ccb58242866b0ba3edbef8fe44214a101c2b3e Mon Sep 17 00:00:00 2001
2 From: Neel Mehta <nmehta@google.com>
3 Date: Fri, 7 Apr 2017 17:43:02 +0200
4 Subject: [PATCH] Prevent unwanted external entity reference
6 For https://bugzilla.gnome.org/show_bug.cgi?id=780691
8 * parser.c: add a specific check to avoid PE reference
10 parser.c | 9 +++++++++
11 1 file changed, 9 insertions(+)
13 diff --git a/parser.c b/parser.c
14 index 609a2703..c2c812de 100644
17 @@ -8123,6 +8123,15 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
18 if (xmlPushInput(ctxt, input) < 0)
21 + if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
22 + ((ctxt->options & XML_PARSE_NOENT) == 0) &&
23 + ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
24 + ((ctxt->options & XML_PARSE_DTDLOAD) == 0) &&
25 + ((ctxt->options & XML_PARSE_DTDATTR) == 0) &&
26 + (ctxt->replaceEntities == 0) &&
27 + (ctxt->validate == 0))
32 * handle the extra spaces added before and after