Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ec9e05c2
Commit
ec9e05c2
authored
Mar 13, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite/reader: Enter error state on parsing error.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a44a6083
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
14 deletions
+40
-14
reader.c
dlls/xmllite/reader.c
+25
-6
reader.c
dlls/xmllite/tests/reader.c
+15
-8
No files found.
dlls/xmllite/reader.c
View file @
ec9e05c2
...
...
@@ -264,6 +264,7 @@ typedef struct
xmlreaderinput
*
input
;
IMalloc
*
imalloc
;
XmlReadState
state
;
HRESULT
error
;
/* error set on XmlReadState_Error */
XmlReaderInternalState
instate
;
XmlReaderResumeState
resumestate
;
XmlNodeType
nodetype
;
...
...
@@ -2821,19 +2822,37 @@ static HRESULT WINAPI xmlreader_Read(IXmlReader* iface, XmlNodeType *nodetype)
{
xmlreader
*
This
=
impl_from_IXmlReader
(
iface
);
XmlNodeType
oldtype
=
This
->
nodetype
;
XmlNodeType
type
;
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
nodetype
);
if
(
This
->
state
==
XmlReadState_Closed
)
return
S_FALSE
;
if
(
!
nodetype
)
nodetype
=
&
type
;
hr
=
reader_parse_nextnode
(
This
);
if
(
oldtype
==
XmlNodeType_None
&&
This
->
nodetype
!=
oldtype
)
This
->
state
=
XmlReadState_Interactive
;
switch
(
This
->
state
)
{
case
XmlReadState_Closed
:
hr
=
S_FALSE
;
break
;
case
XmlReadState_Error
:
hr
=
This
->
error
;
break
;
default:
hr
=
reader_parse_nextnode
(
This
);
if
(
SUCCEEDED
(
hr
)
&&
oldtype
==
XmlNodeType_None
&&
This
->
nodetype
!=
oldtype
)
This
->
state
=
XmlReadState_Interactive
;
if
(
FAILED
(
hr
))
{
This
->
state
=
XmlReadState_Error
;
This
->
nodetype
=
XmlNodeType_None
;
This
->
error
=
hr
;
}
}
TRACE
(
"node type %s
\n
"
,
debugstr_nodetype
(
This
->
nodetype
));
if
(
nodetype
)
*
nodetype
=
This
->
nodetype
;
*
nodetype
=
This
->
nodetype
;
return
hr
;
}
...
...
dlls/xmllite/tests/reader.c
View file @
ec9e05c2
...
...
@@ -1559,8 +1559,8 @@ static void test_read_element(void)
type
=
XmlNodeType_Element
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
WC_E_ELEMENTMATCH
,
"got %08x
\n
"
,
hr
);
todo_wine
ok
(
type
==
XmlNodeType_None
,
"got %d
\n
"
,
type
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
IStream_Release
(
stream
);
...
...
@@ -2369,6 +2369,7 @@ static void test_max_element_depth(void)
"</c>"
"</b>"
"</a>"
;
XmlNodeType
nodetype
;
unsigned
int
count
;
IXmlReader
*
reader
;
IStream
*
stream
;
...
...
@@ -2401,20 +2402,19 @@ static void test_max_element_depth(void)
hr
=
IXmlReader_Read
(
reader
,
NULL
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"got %08x
\n
"
,
hr
);
todo_wine
{
todo_wine
TEST_DEPTH2
(
reader
,
0
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
}
hr
=
IXmlReader_SetProperty
(
reader
,
XmlReaderProperty_MaxElementDepth
,
10
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
todo_wine
{
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"got %08x
\n
"
,
hr
);
todo_wine
TEST_DEPTH2
(
reader
,
0
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
}
IStream_Release
(
stream
);
/* test if stepping into attributes enforces depth limit too */
...
...
@@ -2444,13 +2444,20 @@ todo_wine {
TEST_DEPTH
(
reader
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Interactive
);
hr
=
IXmlReader_Read
(
reader
,
NULL
);
nodetype
=
123
;
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"got %08x
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"got node type %d
\n
"
,
nodetype
);
todo_wine
{
nodetype
=
123
;
hr
=
IXmlReader_Read
(
reader
,
&
nodetype
);
ok
(
hr
==
SC_E_MAXELEMENTDEPTH
,
"got %08x
\n
"
,
hr
);
ok
(
nodetype
==
XmlNodeType_None
,
"got node type %d
\n
"
,
nodetype
);
todo_wine
TEST_DEPTH2
(
reader
,
0
,
2
);
TEST_READER_STATE
(
reader
,
XmlReadState_Error
);
}
IStream_Release
(
stream
);
/* set max depth to 0, this disables depth limit */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment