aboutsummaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorDennis Filder <d.filder@web.de>2014-10-06 20:34:14 +0800
committerDaniel Veillard <veillard@redhat.com>2014-10-06 20:34:14 +0800
commit7e9bbdf82f5ef65e2fdd4961ee4dbb62949e1f1f (patch)
tree1595d7c0030969023286f482e3f4fb0558a314e0 /parser.c
parent6d93e9eacf09b6761f1d82138ae543035c0b4776 (diff)
downloadandroid_external_libxml2-7e9bbdf82f5ef65e2fdd4961ee4dbb62949e1f1f.tar.gz
android_external_libxml2-7e9bbdf82f5ef65e2fdd4961ee4dbb62949e1f1f.tar.bz2
android_external_libxml2-7e9bbdf82f5ef65e2fdd4961ee4dbb62949e1f1f.zip
parser bug on misformed namespace attributes
For https://bugzilla.gnome.org/show_bug.cgi?id=672539 Reported by Axel Miller <axel.miller@ppi.de> Consider the following start-tag: <x xmlns=""version=""> The start-tag does not conform to the rule [40] STag ::= '<' Name (S Attribute)* S? '>' since there is no whitespace in front of the attribute "version". Thus, libxml2 should reject the start-tag. But it doesn't: $ echo '<x xmlns=""version=""/>' | xmllint - <?xml version="1.0"?> <x xmlns="" version=""/> The error seems to happen only if there is a namespace declaration in front of the attribute. A missing whitespace between other attributes is handled correctly: $ echo '<x someattr=""version=""/>' | xmllint - -:1: parser error : attributes construct error <x someattr=""version=""/> ^ [...]
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/parser.c b/parser.c
index 3de828bd..2ef2c3b6 100644
--- a/parser.c
+++ b/parser.c
@@ -9386,6 +9386,13 @@ reparse:
if (nsPush(ctxt, NULL, URL) > 0) nbNs++;
skip_default_ns:
if (alloc != 0) xmlFree(attvalue);
+ if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
+ break;
+ if (!IS_BLANK_CH(RAW)) {
+ xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
+ "attributes construct error\n");
+ break;
+ }
SKIP_BLANKS;
continue;
}
@@ -9459,6 +9466,13 @@ skip_default_ns:
if (nsPush(ctxt, attname, URL) > 0) nbNs++;
skip_ns:
if (alloc != 0) xmlFree(attvalue);
+ if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>'))))
+ break;
+ if (!IS_BLANK_CH(RAW)) {
+ xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
+ "attributes construct error\n");
+ break;
+ }
SKIP_BLANKS;
if (ctxt->input->base != base) goto base_changed;
continue;