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
f4890dac
Commit
f4890dac
authored
Jul 01, 2022
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jul 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atl: Avoid NULL pointer reference in AtlComModuleRegisterClassObjects().
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
parent
5739db59
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
2 deletions
+58
-2
atl.c
dlls/atl/atl.c
+2
-2
atl.c
dlls/atl100/tests/atl.c
+28
-0
atl.c
dlls/atl110/tests/atl.c
+28
-0
No files found.
dlls/atl/atl.c
View file @
f4890dac
...
...
@@ -538,7 +538,7 @@ HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE *module, DWORD c
return
E_INVALIDARG
;
for
(
iter
=
module
->
m_ppAutoObjMapFirst
;
iter
<
module
->
m_ppAutoObjMapLast
;
iter
++
)
{
if
(
!
(
*
iter
)
->
pfnGetClassObject
)
if
(
!
(
*
iter
)
||
!
(
*
iter
)
->
pfnGetClassObject
)
continue
;
hres
=
(
*
iter
)
->
pfnGetClassObject
((
*
iter
)
->
pfnCreateInstance
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
...
...
@@ -566,7 +566,7 @@ HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE *module, DWORD c
return
E_INVALIDARG
;
for
(
iter
=
module
->
m_ppAutoObjMapFirst
;
iter
<
module
->
m_ppAutoObjMapLast
;
iter
++
)
{
if
(
!
(
*
iter
)
->
pfnGetClassObject
)
if
(
!
(
*
iter
)
||
!
(
*
iter
)
->
pfnGetClassObject
)
continue
;
hres
=
(
*
iter
)
->
pfnGetClassObject
((
*
iter
)
->
pfnCreateInstance
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
...
...
dlls/atl100/tests/atl.c
View file @
f4890dac
...
...
@@ -1088,6 +1088,33 @@ static void test_AtlComModuleGetClassObject(void)
ok
(
hr
==
CLASS_E_CLASSNOTAVAILABLE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
static
void
test_AtlComModuleRegisterClassObjects
(
void
)
{
_ATL_OBJMAP_ENTRY
*
null_entry
=
NULL
;
_ATL_COM_MODULE
module
;
HRESULT
hr
;
/* Test NULL module */
hr
=
AtlComModuleRegisterClassObjects
(
NULL
,
CLSCTX_INPROC_SERVER
,
REGCLS_MULTIPLEUSE
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
module
.
cbSize
=
sizeof
(
module
);
module
.
m_ppAutoObjMapFirst
=
NULL
;
module
.
m_ppAutoObjMapLast
=
NULL
;
hr
=
AtlComModuleRegisterClassObjects
(
&
module
,
CLSCTX_INPROC_SERVER
,
REGCLS_MULTIPLEUSE
);
todo_wine_if
(
hr
==
S_OK
)
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
module
.
cbSize
=
sizeof
(
module
);
module
.
m_ppAutoObjMapFirst
=
&
null_entry
;
module
.
m_ppAutoObjMapLast
=
&
null_entry
;
hr
=
AtlComModuleRegisterClassObjects
(
&
module
,
CLSCTX_INPROC_SERVER
,
REGCLS_MULTIPLEUSE
);
todo_wine_if
(
hr
==
S_OK
)
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
START_TEST
(
atl
)
{
if
(
!
register_class
())
...
...
@@ -1104,6 +1131,7 @@ START_TEST(atl)
test_AtlAxAttachControl
();
test_AtlAxCreateControl
();
test_AtlComModuleGetClassObject
();
test_AtlComModuleRegisterClassObjects
();
CoUninitialize
();
}
dlls/atl110/tests/atl.c
View file @
f4890dac
...
...
@@ -55,11 +55,39 @@ static void test_AtlComModuleGetClassObject(void)
ok
(
hr
==
CLASS_E_CLASSNOTAVAILABLE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
static
void
test_AtlComModuleRegisterClassObjects
(
void
)
{
_ATL_OBJMAP_ENTRY_EX
*
null_entry
=
NULL
;
_ATL_COM_MODULE
module
;
HRESULT
hr
;
/* Test NULL module */
hr
=
AtlComModuleRegisterClassObjects
(
NULL
,
CLSCTX_INPROC_SERVER
,
REGCLS_MULTIPLEUSE
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
/* Test NULL m_ppAutoObjMapFirst and m_ppAutoObjMapLast */
module
.
cbSize
=
sizeof
(
module
);
module
.
m_ppAutoObjMapFirst
=
NULL
;
module
.
m_ppAutoObjMapLast
=
NULL
;
hr
=
AtlComModuleRegisterClassObjects
(
&
module
,
CLSCTX_INPROC_SERVER
,
REGCLS_MULTIPLEUSE
);
todo_wine_if
(
hr
==
S_OK
)
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
/* Test m_ppAutoObjMapFirst and m_ppAutoObjMapLast both pointing to a NULL entry */
module
.
cbSize
=
sizeof
(
module
);
module
.
m_ppAutoObjMapFirst
=
&
null_entry
;
module
.
m_ppAutoObjMapLast
=
&
null_entry
;
hr
=
AtlComModuleRegisterClassObjects
(
&
module
,
CLSCTX_INPROC_SERVER
,
REGCLS_MULTIPLEUSE
);
todo_wine_if
(
hr
==
S_OK
)
ok
(
hr
==
S_FALSE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
START_TEST
(
atl
)
{
CoInitialize
(
NULL
);
test_AtlComModuleGetClassObject
();
test_AtlComModuleRegisterClassObjects
();
CoUninitialize
();
}
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