Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / external / libxml2 / 0001-Prevent-unwanted-external-entity-reference.patch.1
blob7a935a6ada609e1117dad4b4d032f83157286b5c
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
9 ---
10  parser.c | 9 +++++++++
11  1 file changed, 9 insertions(+)
13 diff --git a/parser.c b/parser.c
14 index 609a2703..c2c812de 100644
15 --- a/parser.c
16 +++ b/parser.c
17 @@ -8123,6 +8123,15 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
18             if (xmlPushInput(ctxt, input) < 0)
19                 return;
20         } else {
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))
28 +               return;
30             /*
31              * TODO !!!
32              * handle the extra spaces added before and after
33 -- 
34 2.13.5