summaryrefslogtreecommitdiffstats
path: root/parser/expat
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-10-23 10:32:13 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-10-23 10:32:13 +0200
commit245bbebbc248151a335c8ab78f3e30438a808379 (patch)
tree0385a74e5fd50c65a9ba48e697d2e196f5f72ae1 /parser/expat
parentdee457e63aa52ac83c0545ae87dc273cbdd072f1 (diff)
downloadUXP-245bbebbc248151a335c8ab78f3e30438a808379.tar
UXP-245bbebbc248151a335c8ab78f3e30438a808379.tar.gz
UXP-245bbebbc248151a335c8ab78f3e30438a808379.tar.lz
UXP-245bbebbc248151a335c8ab78f3e30438a808379.tar.xz
UXP-245bbebbc248151a335c8ab78f3e30438a808379.zip
Issue #1255 - Port upstream fix from libexpat
Diffstat (limited to 'parser/expat')
-rw-r--r--parser/expat/lib/xmlparse.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c
index 93a817764..6ab140c89 100644
--- a/parser/expat/lib/xmlparse.c
+++ b/parser/expat/lib/xmlparse.c
@@ -335,7 +335,7 @@ initializeEncoding(XML_Parser parser);
static enum XML_Error
doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
const char *end, int tok, const char *next, const char **nextPtr,
- XML_Bool haveMore);
+ XML_Bool haveMore, XML_Bool allowClosingDoctype);
static enum XML_Error
processInternalEntity(XML_Parser parser, ENTITY *entity,
XML_Bool betweenDecl);
@@ -3760,7 +3760,7 @@ externalParEntProcessor(XML_Parser parser,
processor = prologProcessor;
return doProlog(parser, encoding, s, end, tok, next,
- nextPtr, (XML_Bool)!ps_finalBuffer);
+ nextPtr, (XML_Bool)!ps_finalBuffer, XML_TRUE);
}
static enum XML_Error PTRCALL
@@ -3810,7 +3810,7 @@ prologProcessor(XML_Parser parser,
const char *next = s;
int tok = XmlPrologTok(encoding, s, end, &next);
return doProlog(parser, encoding, s, end, tok, next,
- nextPtr, (XML_Bool)!ps_finalBuffer);
+ nextPtr, (XML_Bool)!ps_finalBuffer, XML_TRUE);
}
static enum XML_Error
@@ -3821,7 +3821,8 @@ doProlog(XML_Parser parser,
int tok,
const char *next,
const char **nextPtr,
- XML_Bool haveMore)
+ XML_Bool haveMore,
+ XML_Bool allowClosingDoctype)
{
#ifdef XML_DTD
static const XML_Char externalSubsetName[] = { '#' , '\0' };
@@ -3987,6 +3988,11 @@ doProlog(XML_Parser parser,
}
break;
case XML_ROLE_DOCTYPE_CLOSE:
+ if (allowClosingDoctype != XML_TRUE) {
+ /* Must not close doctype from within expanded parameter entities */
+ return XML_ERROR_INVALID_TOKEN;
+ }
+
if (doctypeName) {
startDoctypeDeclHandler(handlerArg, doctypeName,
doctypeSysid, doctypePubid, 0);
@@ -4892,7 +4898,7 @@ processInternalEntity(XML_Parser parser, ENTITY *entity,
if (entity->is_param) {
int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
result = doProlog(parser, internalEncoding, textStart, textEnd, tok,
- next, &next, XML_FALSE);
+ next, &next, XML_FALSE, XML_FALSE);
}
else
#endif /* XML_DTD */
@@ -4959,7 +4965,7 @@ internalEntityProcessor(XML_Parser parser,
if (entity->is_param) {
int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next);
result = doProlog(parser, internalEncoding, textStart, textEnd, tok,
- next, &next, XML_FALSE);
+ next, &next, XML_FALSE, XML_TRUE);
}
else
#endif /* XML_DTD */
@@ -4986,7 +4992,7 @@ internalEntityProcessor(XML_Parser parser,
processor = prologProcessor;
tok = XmlPrologTok(encoding, s, end, &next);
return doProlog(parser, encoding, s, end, tok, next, nextPtr,
- (XML_Bool)!ps_finalBuffer);
+ (XML_Bool)!ps_finalBuffer, XML_TRUE);
}
else
#endif /* XML_DTD */