summaryrefslogtreecommitdiff
path: root/source/fitz/xml.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-10-30 16:02:08 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-11-05 15:56:28 +0100
commita7ea508d281352b1fae056b5c8e86648063b2629 (patch)
tree9430694100cac4cde522d45ff2eef1082139b9ee /source/fitz/xml.c
parentd6b312aa86bb78faeb0bf430464a494d1113a62c (diff)
downloadmupdf-a7ea508d281352b1fae056b5c8e86648063b2629.tar.xz
Ignore <!DOCTYPE ...> declaration in XML parser.
Diffstat (limited to 'source/fitz/xml.c')
-rw-r--r--source/fitz/xml.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/fitz/xml.c b/source/fitz/xml.c
index 958eb51c..be233185 100644
--- a/source/fitz/xml.c
+++ b/source/fitz/xml.c
@@ -288,6 +288,7 @@ parse_element:
parse_comment:
if (*p == '[') goto parse_cdata;
+ if (*p == 'D' && !memcmp(p, "DOCTYPE", 7)) goto parse_declaration;
if (*p++ != '-') return "syntax error in comment (<! not followed by --)";
if (*p++ != '-') return "syntax error in comment (<!- not followed by -)";
/* mark = p; */
@@ -300,6 +301,10 @@ parse_comment:
}
return "end of data in comment";
+parse_declaration:
+ while (*p) if (*p++ == '>') goto parse_text;
+ return "end of data in declaration";
+
parse_cdata:
if (p[1] != 'C' || p[2] != 'D' || p[3] != 'A' || p[4] != 'T' || p[5] != 'A' || p[6] != '[')
return "syntax error in CDATA section";