xmllite/reader: Return correct error for multiple colons in qualified name.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-03-10 11:06:41 +03:00 committed by Alexandre Julliard
parent 3b83a44639
commit 62a41d035c
2 changed files with 8 additions and 3 deletions

View File

@ -1838,7 +1838,7 @@ static HRESULT reader_parse_dtd(xmlreader *reader)
}
/* [11 NS] LocalPart ::= NCName */
static HRESULT reader_parse_local(xmlreader *reader, strval *local)
static HRESULT reader_parse_local(xmlreader *reader, strval *local, BOOL check_for_separator)
{
WCHAR *ptr;
UINT start;
@ -1860,6 +1860,9 @@ static HRESULT reader_parse_local(xmlreader *reader, strval *local)
ptr = reader_get_ptr(reader);
}
if (check_for_separator && *ptr == ':')
return NC_E_QNAMECOLON;
if (is_reader_pending(reader))
{
reader->resume[XmlReadResume_Local] = start;
@ -1898,7 +1901,7 @@ static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *loc
if (reader->resume[XmlReadResume_Local])
{
hr = reader_parse_local(reader, local);
hr = reader_parse_local(reader, local, FALSE);
if (FAILED(hr)) return hr;
reader_init_strvalue(reader->resume[XmlReadResume_Name],
@ -1923,7 +1926,7 @@ static HRESULT reader_parse_qname(xmlreader *reader, strval *prefix, strval *loc
/* skip ':' */
reader_skipn(reader, 1);
hr = reader_parse_local(reader, local);
hr = reader_parse_local(reader, local, TRUE);
if (FAILED(hr)) return hr;
}
else

View File

@ -1415,6 +1415,8 @@ static struct test_entry element_tests[] = {
{ "<a >", "a", "", S_OK },
{ "<a \r \t\n>", "a", "", S_OK },
{ "</a>", NULL, NULL, NC_E_QNAMECHARACTER },
{ "<a:b:c />", NULL, NULL, NC_E_QNAMECOLON },
{ "<:b:c />", NULL, NULL, NC_E_QNAMECHARACTER },
{ NULL }
};