[libxml2] Fix regression parsing public IDs literals in HTML



commit 2732b234665ebfcfe33bfb962a7c40cb7031c6c4
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Jan 10 13:32:14 2022 +0100

    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(-)
---
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 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head><meta http-equiv='\"content-type\"' content='\"text/html;charset=utf-8\"'></head>
+<body>
+</body>
+</html>
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 @@
+<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'>
+<html>
+<head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"></head>
+<body>
+</body>
+</html>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]