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
66b5dd71
Commit
66b5dd71
authored
Jul 31, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3/saxreader: Fix attributes array growing size.
parent
bf10dd3e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
30 deletions
+35
-30
saxreader.c
dlls/msxml3/saxreader.c
+35
-30
No files found.
dlls/msxml3/saxreader.c
View file @
66b5dd71
...
@@ -301,8 +301,8 @@ typedef struct
...
@@ -301,8 +301,8 @@ typedef struct
struct
list
elements
;
struct
list
elements
;
BSTR
namespaceUri
;
BSTR
namespaceUri
;
int
attr
ibutesSize
;
int
attr
_alloc_count
;
int
nb_attributes
;
int
attr_count
;
struct
_attributes
struct
_attributes
{
{
BSTR
szLocalname
;
BSTR
szLocalname
;
...
@@ -1106,11 +1106,16 @@ static HRESULT WINAPI isaxattributes_getLength(
...
@@ -1106,11 +1106,16 @@ static HRESULT WINAPI isaxattributes_getLength(
{
{
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
*
length
=
This
->
nb_attributes
;
*
length
=
This
->
attr_count
;
TRACE
(
"Length set to %d
\n
"
,
*
length
);
TRACE
(
"Length set to %d
\n
"
,
*
length
);
return
S_OK
;
return
S_OK
;
}
}
static
inline
BOOL
is_valid_attr_index
(
const
saxlocator
*
locator
,
int
index
)
{
return
index
<
locator
->
attr_count
&&
index
>=
0
;
}
static
HRESULT
WINAPI
isaxattributes_getURI
(
static
HRESULT
WINAPI
isaxattributes_getURI
(
ISAXAttributes
*
iface
,
ISAXAttributes
*
iface
,
int
index
,
int
index
,
...
@@ -1120,7 +1125,7 @@ static HRESULT WINAPI isaxattributes_getURI(
...
@@ -1120,7 +1125,7 @@ static HRESULT WINAPI isaxattributes_getURI(
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
index
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
index
);
if
(
index
>=
This
->
nb_attributes
||
index
<
0
)
return
E_INVALIDARG
;
if
(
!
is_valid_attr_index
(
This
,
index
)
)
return
E_INVALIDARG
;
if
(
!
url
||
!
size
)
return
E_POINTER
;
if
(
!
url
||
!
size
)
return
E_POINTER
;
*
size
=
SysStringLen
(
This
->
attributes
[
index
].
szURI
);
*
size
=
SysStringLen
(
This
->
attributes
[
index
].
szURI
);
...
@@ -1133,36 +1138,36 @@ static HRESULT WINAPI isaxattributes_getURI(
...
@@ -1133,36 +1138,36 @@ static HRESULT WINAPI isaxattributes_getURI(
static
HRESULT
WINAPI
isaxattributes_getLocalName
(
static
HRESULT
WINAPI
isaxattributes_getLocalName
(
ISAXAttributes
*
iface
,
ISAXAttributes
*
iface
,
int
nI
ndex
,
int
i
ndex
,
const
WCHAR
**
pLocalName
,
const
WCHAR
**
pLocalName
,
int
*
pLocalNameLength
)
int
*
pLocalNameLength
)
{
{
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
nI
ndex
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
i
ndex
);
if
(
nIndex
>=
This
->
nb_attributes
||
nIndex
<
0
)
return
E_INVALIDARG
;
if
(
!
is_valid_attr_index
(
This
,
index
)
)
return
E_INVALIDARG
;
if
(
!
pLocalName
||
!
pLocalNameLength
)
return
E_POINTER
;
if
(
!
pLocalName
||
!
pLocalNameLength
)
return
E_POINTER
;
*
pLocalNameLength
=
SysStringLen
(
This
->
attributes
[
nI
ndex
].
szLocalname
);
*
pLocalNameLength
=
SysStringLen
(
This
->
attributes
[
i
ndex
].
szLocalname
);
*
pLocalName
=
This
->
attributes
[
nI
ndex
].
szLocalname
;
*
pLocalName
=
This
->
attributes
[
i
ndex
].
szLocalname
;
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
isaxattributes_getQName
(
static
HRESULT
WINAPI
isaxattributes_getQName
(
ISAXAttributes
*
iface
,
ISAXAttributes
*
iface
,
int
nI
ndex
,
int
i
ndex
,
const
WCHAR
**
pQName
,
const
WCHAR
**
pQName
,
int
*
pQNameLength
)
int
*
pQNameLength
)
{
{
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
nI
ndex
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
i
ndex
);
if
(
nIndex
>=
This
->
nb_attributes
||
nIndex
<
0
)
return
E_INVALIDARG
;
if
(
!
is_valid_attr_index
(
This
,
index
)
)
return
E_INVALIDARG
;
if
(
!
pQName
||
!
pQNameLength
)
return
E_POINTER
;
if
(
!
pQName
||
!
pQNameLength
)
return
E_POINTER
;
*
pQNameLength
=
SysStringLen
(
This
->
attributes
[
nI
ndex
].
szQName
);
*
pQNameLength
=
SysStringLen
(
This
->
attributes
[
i
ndex
].
szQName
);
*
pQName
=
This
->
attributes
[
nI
ndex
].
szQName
;
*
pQName
=
This
->
attributes
[
i
ndex
].
szQName
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -1180,7 +1185,7 @@ static HRESULT WINAPI isaxattributes_getName(
...
@@ -1180,7 +1185,7 @@ static HRESULT WINAPI isaxattributes_getName(
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
index
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
index
);
if
(
index
>=
This
->
nb_attributes
||
index
<
0
)
return
E_INVALIDARG
;
if
(
!
is_valid_attr_index
(
This
,
index
)
)
return
E_INVALIDARG
;
if
(
!
uri
||
!
pUriLength
||
!
localName
||
!
pLocalNameSize
if
(
!
uri
||
!
pUriLength
||
!
localName
||
!
pLocalNameSize
||
!
QName
||
!
pQNameLength
)
return
E_POINTER
;
||
!
QName
||
!
pQNameLength
)
return
E_POINTER
;
...
@@ -1211,7 +1216,7 @@ static HRESULT WINAPI isaxattributes_getIndexFromName(
...
@@ -1211,7 +1216,7 @@ static HRESULT WINAPI isaxattributes_getIndexFromName(
if
(
!
pUri
||
!
pLocalName
||
!
index
)
return
E_POINTER
;
if
(
!
pUri
||
!
pLocalName
||
!
index
)
return
E_POINTER
;
for
(
i
=
0
;
i
<
This
->
nb_attributes
;
i
++
)
for
(
i
=
0
;
i
<
This
->
attr_count
;
i
++
)
{
{
if
(
cUriLength
!=
SysStringLen
(
This
->
attributes
[
i
].
szURI
)
if
(
cUriLength
!=
SysStringLen
(
This
->
attributes
[
i
].
szURI
)
||
cocalNameLength
!=
SysStringLen
(
This
->
attributes
[
i
].
szLocalname
))
||
cocalNameLength
!=
SysStringLen
(
This
->
attributes
[
i
].
szLocalname
))
...
@@ -1243,7 +1248,7 @@ static HRESULT WINAPI isaxattributes_getIndexFromQName(
...
@@ -1243,7 +1248,7 @@ static HRESULT WINAPI isaxattributes_getIndexFromQName(
if
(
!
pQName
||
!
index
)
return
E_POINTER
;
if
(
!
pQName
||
!
index
)
return
E_POINTER
;
if
(
!
nQNameLength
)
return
E_INVALIDARG
;
if
(
!
nQNameLength
)
return
E_INVALIDARG
;
for
(
i
=
0
;
i
<
This
->
nb_attributes
;
i
++
)
for
(
i
=
0
;
i
<
This
->
attr_count
;
i
++
)
{
{
if
(
nQNameLength
!=
SysStringLen
(
This
->
attributes
[
i
].
szQName
))
continue
;
if
(
nQNameLength
!=
SysStringLen
(
This
->
attributes
[
i
].
szQName
))
continue
;
if
(
memcmp
(
pQName
,
This
->
attributes
[
i
].
szQName
,
sizeof
(
WCHAR
)
*
nQNameLength
))
continue
;
if
(
memcmp
(
pQName
,
This
->
attributes
[
i
].
szQName
,
sizeof
(
WCHAR
)
*
nQNameLength
))
continue
;
...
@@ -1305,7 +1310,7 @@ static HRESULT WINAPI isaxattributes_getValue(
...
@@ -1305,7 +1310,7 @@ static HRESULT WINAPI isaxattributes_getValue(
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
saxlocator
*
This
=
impl_from_ISAXAttributes
(
iface
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
index
);
TRACE
(
"(%p)->(%d)
\n
"
,
This
,
index
);
if
(
index
>=
This
->
nb_attributes
||
index
<
0
)
return
E_INVALIDARG
;
if
(
!
is_valid_attr_index
(
This
,
index
)
)
return
E_INVALIDARG
;
if
(
!
value
||
!
nValue
)
return
E_POINTER
;
if
(
!
value
||
!
nValue
)
return
E_POINTER
;
*
nValue
=
SysStringLen
(
This
->
attributes
[
index
].
szValue
);
*
nValue
=
SysStringLen
(
This
->
attributes
[
index
].
szValue
);
...
@@ -1423,7 +1428,7 @@ static void free_attribute_values(saxlocator *locator)
...
@@ -1423,7 +1428,7 @@ static void free_attribute_values(saxlocator *locator)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
locator
->
nb_attributes
;
i
++
)
for
(
i
=
0
;
i
<
locator
->
attr_count
;
i
++
)
{
{
SysFreeString
(
locator
->
attributes
[
i
].
szLocalname
);
SysFreeString
(
locator
->
attributes
[
i
].
szLocalname
);
locator
->
attributes
[
i
].
szLocalname
=
NULL
;
locator
->
attributes
[
i
].
szLocalname
=
NULL
;
...
@@ -1450,19 +1455,19 @@ static HRESULT SAXAttributes_populate(saxlocator *locator,
...
@@ -1450,19 +1455,19 @@ static HRESULT SAXAttributes_populate(saxlocator *locator,
if
((
locator
->
saxreader
->
features
&
NamespacePrefixes
)
==
0
)
if
((
locator
->
saxreader
->
features
&
NamespacePrefixes
)
==
0
)
nb_namespaces
=
0
;
nb_namespaces
=
0
;
locator
->
nb_attributes
=
nb_namespaces
+
nb_attributes
;
locator
->
attr_count
=
nb_namespaces
+
nb_attributes
;
if
(
locator
->
nb_attributes
>
locator
->
attributesSize
)
if
(
locator
->
attr_count
>
locator
->
attr_alloc_count
)
{
{
int
new_size
=
locator
->
attr
ibutesSize
*
2
;
int
new_size
=
locator
->
attr
_count
*
2
;
attrs
=
heap_realloc_zero
(
locator
->
attributes
,
new_size
*
sizeof
(
struct
_attributes
));
attrs
=
heap_realloc_zero
(
locator
->
attributes
,
new_size
*
sizeof
(
struct
_attributes
));
if
(
!
attrs
)
if
(
!
attrs
)
{
{
free_attribute_values
(
locator
);
free_attribute_values
(
locator
);
locator
->
nb_attributes
=
0
;
locator
->
attr_count
=
0
;
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
locator
->
attributes
=
attrs
;
locator
->
attributes
=
attrs
;
locator
->
attr
ibutesSize
=
new_size
;
locator
->
attr
_alloc_count
=
new_size
;
}
}
else
else
{
{
...
@@ -1706,7 +1711,7 @@ static void libxmlEndElementNS(
...
@@ -1706,7 +1711,7 @@ static void libxmlEndElementNS(
if
(
!
saxreader_has_handler
(
This
,
SAXContentHandler
))
if
(
!
saxreader_has_handler
(
This
,
SAXContentHandler
))
{
{
free_attribute_values
(
This
);
free_attribute_values
(
This
);
This
->
nb_attributes
=
0
;
This
->
attr_count
=
0
;
free_element_entry
(
element
);
free_element_entry
(
element
);
return
;
return
;
}
}
...
@@ -1728,7 +1733,7 @@ static void libxmlEndElementNS(
...
@@ -1728,7 +1733,7 @@ static void libxmlEndElementNS(
element
->
qname
,
SysStringLen
(
element
->
qname
));
element
->
qname
,
SysStringLen
(
element
->
qname
));
free_attribute_values
(
This
);
free_attribute_values
(
This
);
This
->
nb_attributes
=
0
;
This
->
attr_count
=
0
;
if
(
sax_callback_failed
(
This
,
hr
))
if
(
sax_callback_failed
(
This
,
hr
))
{
{
...
@@ -2326,7 +2331,7 @@ static ULONG WINAPI isaxlocator_Release(
...
@@ -2326,7 +2331,7 @@ static ULONG WINAPI isaxlocator_Release(
SysFreeString
(
This
->
systemId
);
SysFreeString
(
This
->
systemId
);
SysFreeString
(
This
->
namespaceUri
);
SysFreeString
(
This
->
namespaceUri
);
for
(
index
=
0
;
index
<
This
->
attributesSize
;
index
++
)
for
(
index
=
0
;
index
<
This
->
attr_alloc_count
;
index
++
)
{
{
SysFreeString
(
This
->
attributes
[
index
].
szLocalname
);
SysFreeString
(
This
->
attributes
[
index
].
szLocalname
);
SysFreeString
(
This
->
attributes
[
index
].
szValue
);
SysFreeString
(
This
->
attributes
[
index
].
szValue
);
...
@@ -2462,9 +2467,9 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
...
@@ -2462,9 +2467,9 @@ static HRESULT SAXLocator_create(saxreader *reader, saxlocator **ppsaxlocator, B
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
locator
->
attr
ibutesSize
=
8
;
locator
->
attr
_alloc_count
=
8
;
locator
->
nb_attributes
=
0
;
locator
->
attr_count
=
0
;
locator
->
attributes
=
heap_alloc_zero
(
sizeof
(
struct
_attributes
)
*
locator
->
attr
ibutesSize
);
locator
->
attributes
=
heap_alloc_zero
(
sizeof
(
struct
_attributes
)
*
locator
->
attr
_alloc_count
);
if
(
!
locator
->
attributes
)
if
(
!
locator
->
attributes
)
{
{
ISAXXMLReader_Release
(
&
reader
->
ISAXXMLReader_iface
);
ISAXXMLReader_Release
(
&
reader
->
ISAXXMLReader_iface
);
...
...
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