Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
80e70a82
Commit
80e70a82
authored
Jun 18, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmllite: Handle nesting depth limit better.
parent
40c72e47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
reader.c
dlls/xmllite/reader.c
+10
-2
reader.c
dlls/xmllite/tests/reader.c
+4
-1
No files found.
dlls/xmllite/reader.c
View file @
80e70a82
...
...
@@ -246,6 +246,7 @@ typedef struct
struct
list
elements
;
strval
strvalues
[
StringValue_Last
];
UINT
depth
;
UINT
max_depth
;
BOOL
empty_element
;
WCHAR
*
resume
[
XmlReadResume_Last
];
/* pointers used to resume reader */
}
xmlreader
;
...
...
@@ -427,11 +428,15 @@ static void reader_clear_elements(xmlreader *reader)
static
HRESULT
reader_inc_depth
(
xmlreader
*
reader
)
{
/* FIXME: handle XmlReaderProperty_MaxElementDepth property */
reader
->
depth
++
;
if
(
++
reader
->
depth
>
reader
->
max_depth
)
return
SC_E_MAXELEMENTDEPTH
;
return
S_OK
;
}
static
void
reader_dec_depth
(
xmlreader
*
reader
)
{
if
(
reader
->
depth
>
1
)
reader
->
depth
--
;
}
static
HRESULT
reader_push_element
(
xmlreader
*
reader
,
strval
*
qname
)
{
struct
element
*
elem
;
...
...
@@ -469,6 +474,7 @@ static void reader_pop_element(xmlreader *reader)
list_remove
(
&
elem
->
entry
);
reader_free_strvalued
(
reader
,
&
elem
->
qname
);
reader_free
(
reader
,
elem
);
reader_dec_depth
(
reader
);
}
}
...
...
@@ -1137,6 +1143,7 @@ static HRESULT reader_parse_xmldecl(xmlreader *reader)
if
(
reader_cmp
(
reader
,
declcloseW
))
return
WC_E_XMLDECL
;
reader_skipn
(
reader
,
2
);
reader_inc_depth
(
reader
);
reader
->
nodetype
=
XmlNodeType_XmlDeclaration
;
reader_set_strvalue
(
reader
,
StringValue_LocalName
,
&
strval_empty
);
reader_set_strvalue
(
reader
,
StringValue_QualifiedName
,
&
strval_empty
);
...
...
@@ -2659,6 +2666,7 @@ HRESULT WINAPI CreateXmlReader(REFIID riid, void **obj, IMalloc *imalloc)
reader
->
attr
=
NULL
;
list_init
(
&
reader
->
elements
);
reader
->
depth
=
0
;
reader
->
max_depth
=
256
;
reader
->
empty_element
=
FALSE
;
memset
(
reader
->
resume
,
0
,
sizeof
(
reader
->
resume
));
...
...
dlls/xmllite/tests/reader.c
View file @
80e70a82
...
...
@@ -742,7 +742,6 @@ static void test_read_xmldeclaration(void)
hr
=
IXmlReader_GetDepth
(
reader
,
&
count
);
ok
(
hr
==
S_OK
,
"Expected S_OK, got %08x
\n
"
,
hr
);
todo_wine
ok
(
count
==
1
,
"Expected 1, got %d
\n
"
,
count
);
hr
=
IXmlReader_MoveToElement
(
reader
);
...
...
@@ -1166,16 +1165,20 @@ static void test_read_element(void)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
depth
==
0
,
"got %d
\n
"
,
depth
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"got %d
\n
"
,
type
);
depth
=
1
;
hr
=
IXmlReader_GetDepth
(
reader
,
&
depth
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
depth
==
0
,
"got %d
\n
"
,
depth
);
type
=
XmlNodeType_None
;
hr
=
IXmlReader_Read
(
reader
,
&
type
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
type
==
XmlNodeType_Element
,
"got %d
\n
"
,
type
);
depth
=
0
;
hr
=
IXmlReader_GetDepth
(
reader
,
&
depth
);
...
...
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