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
2b5dd13a
Commit
2b5dd13a
authored
Jul 01, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msxml3: Fix putref_schemas()/get_schemas() behaviour on NULL pointer.
parent
892b2108
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
13 deletions
+93
-13
domdoc.c
dlls/msxml3/domdoc.c
+20
-13
domdoc.c
dlls/msxml3/tests/domdoc.c
+73
-0
No files found.
dlls/msxml3/domdoc.c
View file @
2b5dd13a
...
...
@@ -2553,22 +2553,23 @@ static HRESULT WINAPI domdoc_get_namespaces(
static
HRESULT
WINAPI
domdoc_get_schemas
(
IXMLDOMDocument3
*
iface
,
VARIANT
*
var1
)
VARIANT
*
schema
)
{
domdoc
*
This
=
impl_from_IXMLDOMDocument3
(
iface
);
HRESULT
hr
=
S_FALSE
;
IXMLDOMSchemaCollection2
*
cur_schema
=
This
->
properties
->
schemaCache
;
HRESULT
hr
=
S_FALSE
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
var1
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
schema
);
VariantInit
(
var1
);
/* Test shows we don't call VariantClear here */
V_VT
(
var1
)
=
VT_NULL
;
V_VT
(
schema
)
=
VT_NULL
;
/* just to reset pointer part, cause that's what application is expected to use */
V_DISPATCH
(
schema
)
=
NULL
;
if
(
cur_schema
)
{
hr
=
IXMLDOMSchemaCollection2_QueryInterface
(
cur_schema
,
&
IID_IDispatch
,
(
void
**
)
&
V_DISPATCH
(
var1
));
hr
=
IXMLDOMSchemaCollection2_QueryInterface
(
cur_schema
,
&
IID_IDispatch
,
(
void
**
)
&
V_DISPATCH
(
schema
));
if
(
SUCCEEDED
(
hr
))
V_VT
(
var1
)
=
VT_DISPATCH
;
V_VT
(
schema
)
=
VT_DISPATCH
;
}
return
hr
;
}
...
...
@@ -2585,13 +2586,19 @@ static HRESULT WINAPI domdoc_putref_schemas(
switch
(
V_VT
(
&
schema
))
{
case
VT_UNKNOWN
:
hr
=
IUnknown_QueryInterface
(
V_UNKNOWN
(
&
schema
),
&
IID_IXMLDOMSchemaCollection
,
(
void
**
)
&
new_schema
);
break
;
if
(
V_UNKNOWN
(
&
schema
))
{
hr
=
IUnknown_QueryInterface
(
V_UNKNOWN
(
&
schema
),
&
IID_IXMLDOMSchemaCollection
,
(
void
**
)
&
new_schema
);
break
;
}
/* fallthrough */
case
VT_DISPATCH
:
hr
=
IDispatch_QueryInterface
(
V_DISPATCH
(
&
schema
),
&
IID_IXMLDOMSchemaCollection
,
(
void
**
)
&
new_schema
);
break
;
if
(
V_DISPATCH
(
&
schema
))
{
hr
=
IDispatch_QueryInterface
(
V_DISPATCH
(
&
schema
),
&
IID_IXMLDOMSchemaCollection
,
(
void
**
)
&
new_schema
);
break
;
}
/* fallthrough */
case
VT_NULL
:
case
VT_EMPTY
:
hr
=
S_OK
;
...
...
dlls/msxml3/tests/domdoc.c
View file @
2b5dd13a
...
...
@@ -12055,6 +12055,78 @@ static void test_put_data(void)
free_bstrs
();
}
static
void
test_putref_schemas
(
void
)
{
IXMLDOMSchemaCollection
*
cache
;
IXMLDOMDocument2
*
doc
;
VARIANT
schema
;
HRESULT
hr
;
doc
=
create_document
(
&
IID_IXMLDOMDocument2
);
if
(
!
doc
)
return
;
cache
=
create_cache
(
&
IID_IXMLDOMSchemaCollection
);
/* set to NULL iface when no schema is set */
V_VT
(
&
schema
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
schema
)
=
NULL
;
hr
=
IXMLDOMDocument2_putref_schemas
(
doc
,
schema
);
EXPECT_HR
(
hr
,
S_OK
);
V_VT
(
&
schema
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
schema
)
=
NULL
;
hr
=
IXMLDOMDocument2_putref_schemas
(
doc
,
schema
);
EXPECT_HR
(
hr
,
S_OK
);
/* set as VT_DISPATCH, reset with it */
V_VT
(
&
schema
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
schema
)
=
(
IDispatch
*
)
cache
;
hr
=
IXMLDOMDocument2_putref_schemas
(
doc
,
schema
);
EXPECT_HR
(
hr
,
S_OK
);
V_DISPATCH
(
&
schema
)
=
NULL
;
hr
=
IXMLDOMDocument2_get_schemas
(
doc
,
&
schema
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_DISPATCH
(
&
schema
)
==
(
IDispatch
*
)
cache
,
"got %p
\n
"
,
V_DISPATCH
(
&
schema
));
V_VT
(
&
schema
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
schema
)
=
NULL
;
hr
=
IXMLDOMDocument2_putref_schemas
(
doc
,
schema
);
EXPECT_HR
(
hr
,
S_OK
);
V_DISPATCH
(
&
schema
)
=
(
IDispatch
*
)
0xdeadbeef
;
V_VT
(
&
schema
)
=
VT_I2
;
hr
=
IXMLDOMDocument2_get_schemas
(
doc
,
&
schema
);
EXPECT_HR
(
hr
,
S_FALSE
);
ok
(
V_DISPATCH
(
&
schema
)
==
NULL
,
"got %p
\n
"
,
V_DISPATCH
(
&
schema
));
ok
(
V_VT
(
&
schema
)
==
VT_NULL
,
"got %d
\n
"
,
V_VT
(
&
schema
));
/* set as VT_UNKNOWN, reset with it */
V_VT
(
&
schema
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
schema
)
=
(
IUnknown
*
)
cache
;
hr
=
IXMLDOMDocument2_putref_schemas
(
doc
,
schema
);
EXPECT_HR
(
hr
,
S_OK
);
V_DISPATCH
(
&
schema
)
=
NULL
;
hr
=
IXMLDOMDocument2_get_schemas
(
doc
,
&
schema
);
EXPECT_HR
(
hr
,
S_OK
);
ok
(
V_DISPATCH
(
&
schema
)
==
(
IDispatch
*
)
cache
,
"got %p
\n
"
,
V_DISPATCH
(
&
schema
));
V_VT
(
&
schema
)
=
VT_UNKNOWN
;
V_UNKNOWN
(
&
schema
)
=
NULL
;
hr
=
IXMLDOMDocument2_putref_schemas
(
doc
,
schema
);
EXPECT_HR
(
hr
,
S_OK
);
V_DISPATCH
(
&
schema
)
=
(
IDispatch
*
)
0xdeadbeef
;
V_VT
(
&
schema
)
=
VT_I2
;
hr
=
IXMLDOMDocument2_get_schemas
(
doc
,
&
schema
);
EXPECT_HR
(
hr
,
S_FALSE
);
ok
(
V_DISPATCH
(
&
schema
)
==
NULL
,
"got %p
\n
"
,
V_DISPATCH
(
&
schema
));
ok
(
V_VT
(
&
schema
)
==
VT_NULL
,
"got %d
\n
"
,
V_VT
(
&
schema
));
IXMLDOMSchemaCollection_Release
(
cache
);
IXMLDOMDocument2_Release
(
doc
);
}
START_TEST
(
domdoc
)
{
IXMLDOMDocument
*
doc
;
...
...
@@ -12134,6 +12206,7 @@ START_TEST(domdoc)
test_nodeValue
();
test_get_namespaces
();
test_put_data
();
test_putref_schemas
();
test_xsltemplate
();
...
...
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