From 2732b234665ebfcfe33bfb962a7c40cb7031c6c4 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Mon, 10 Jan 2022 13:32:14 +0100 Subject: [PATCH] Fix regression parsing public IDs literals in HTML Fix regression introduced when reworking htmlParsePubidLiteral in commit 93ce33c2. Fixes #318. --- HTMLparser.c | 2 +- result/HTML/issue318.html | 6 ++++++ result/HTML/issue318.html.err | 0 result/HTML/issue318.html.sax | 22 ++++++++++++++++++++++ test/HTML/issue318.html | 6 ++++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 result/HTML/issue318.html create mode 100644 result/HTML/issue318.html.err create mode 100644 result/HTML/issue318.html.sax create mode 100644 test/HTML/issue318.html diff --git a/HTMLparser.c b/HTMLparser.c index b56363a3..02d476f9 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -3045,7 +3045,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { NEXT; } - if (CUR != '"') { + if (CUR != quote) { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, "Unfinished PubidLiteral\n", NULL, NULL); } else { diff --git a/result/HTML/issue318.html b/result/HTML/issue318.html new file mode 100644 index 00000000..b3a01e43 --- /dev/null +++ b/result/HTML/issue318.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/result/HTML/issue318.html.err b/result/HTML/issue318.html.err new file mode 100644 index 00000000..e69de29b diff --git a/result/HTML/issue318.html.sax b/result/HTML/issue318.html.sax new file mode 100644 index 00000000..f2f608b4 --- /dev/null +++ b/result/HTML/issue318.html.sax @@ -0,0 +1,22 @@ +SAX.setDocumentLocator() +SAX.startDocument() +SAX.internalSubset(html, -//W3C//DTD HTML 4.01//EN, ) +SAX.startElement(html) +SAX.characters( +, 1) +SAX.startElement(head) +SAX.startElement(meta, http-equiv='\"content-type\"', content='\"text/html;charset=utf-8\"') +SAX.endElement(meta) +SAX.endElement(head) +SAX.characters( +, 1) +SAX.startElement(body) +SAX.characters( +, 1) +SAX.endElement(body) +SAX.characters( +, 1) +SAX.endElement(html) +SAX.characters( +, 1) +SAX.endDocument() diff --git a/test/HTML/issue318.html b/test/HTML/issue318.html new file mode 100644 index 00000000..3bd0b694 --- /dev/null +++ b/test/HTML/issue318.html @@ -0,0 +1,6 @@ + + + + + +