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
5739db59
Commit
5739db59
authored
Jun 28, 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 AtlComModuleGetClassObject().
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
parent
b6225478
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
2 deletions
+102
-2
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
atl.c
dlls/atl/atl.c
+2
-2
atl.c
dlls/atl100/tests/atl.c
+27
-0
Makefile.in
dlls/atl110/tests/Makefile.in
+6
-0
atl.c
dlls/atl110/tests/atl.c
+65
-0
No files found.
configure
View file @
5739db59
...
...
@@ -21227,6 +21227,7 @@ wine_fn_config_makefile dlls/atl/tests enable_tests
wine_fn_config_makefile dlls/atl100 enable_atl100
wine_fn_config_makefile dlls/atl100/tests enable_tests
wine_fn_config_makefile dlls/atl110 enable_atl110
wine_fn_config_makefile dlls/atl110/tests enable_tests
wine_fn_config_makefile dlls/atl80 enable_atl80
wine_fn_config_makefile dlls/atl80/tests enable_tests
wine_fn_config_makefile dlls/atl90 enable_atl90
...
...
configure.ac
View file @
5739db59
...
...
@@ -2394,6 +2394,7 @@ WINE_CONFIG_MAKEFILE(dlls/atl/tests)
WINE_CONFIG_MAKEFILE(dlls/atl100)
WINE_CONFIG_MAKEFILE(dlls/atl100/tests)
WINE_CONFIG_MAKEFILE(dlls/atl110)
WINE_CONFIG_MAKEFILE(dlls/atl110/tests)
WINE_CONFIG_MAKEFILE(dlls/atl80)
WINE_CONFIG_MAKEFILE(dlls/atl80/tests)
WINE_CONFIG_MAKEFILE(dlls/atl90)
...
...
dlls/atl/atl.c
View file @
5739db59
...
...
@@ -482,7 +482,7 @@ HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid,
return
E_INVALIDARG
;
for
(
iter
=
pm
->
m_ppAutoObjMapFirst
;
iter
<
pm
->
m_ppAutoObjMapLast
;
iter
++
)
{
if
(
IsEqualCLSID
((
*
iter
)
->
pclsid
,
rclsid
)
&&
(
*
iter
)
->
pfnGetClassObject
)
{
if
(
*
iter
&&
IsEqualCLSID
((
*
iter
)
->
pclsid
,
rclsid
)
&&
(
*
iter
)
->
pfnGetClassObject
)
{
if
(
!
(
*
iter
)
->
pCF
)
hres
=
(
*
iter
)
->
pfnGetClassObject
((
*
iter
)
->
pfnCreateInstance
,
&
IID_IUnknown
,
(
void
**
)
&
(
*
iter
)
->
pCF
);
if
((
*
iter
)
->
pCF
)
...
...
@@ -507,7 +507,7 @@ HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid,
return
E_INVALIDARG
;
for
(
iter
=
pm
->
m_ppAutoObjMapFirst
;
iter
<
pm
->
m_ppAutoObjMapLast
;
iter
++
)
{
if
(
IsEqualCLSID
((
*
iter
)
->
pclsid
,
rclsid
)
&&
(
*
iter
)
->
pfnGetClassObject
)
{
if
(
*
iter
&&
IsEqualCLSID
((
*
iter
)
->
pclsid
,
rclsid
)
&&
(
*
iter
)
->
pfnGetClassObject
)
{
if
(
!
(
*
iter
)
->
pCache
->
pCF
)
hres
=
(
*
iter
)
->
pfnGetClassObject
((
*
iter
)
->
pfnCreateInstance
,
&
IID_IUnknown
,
(
void
**
)
&
(
*
iter
)
->
pCache
->
pCF
);
if
((
*
iter
)
->
pCache
->
pCF
)
...
...
dlls/atl100/tests/atl.c
View file @
5739db59
...
...
@@ -1062,6 +1062,32 @@ static void test_AtlAxCreateControl(void)
DestroyWindow
(
hwnd
);
}
static
void
test_AtlComModuleGetClassObject
(
void
)
{
_ATL_OBJMAP_ENTRY
*
null_entry
=
NULL
;
_ATL_COM_MODULE
module
;
HRESULT
hr
;
void
*
ret
;
/* Test NULL module */
hr
=
AtlComModuleGetClassObject
(
NULL
,
&
GUID_NULL
,
&
IID_NULL
,
&
ret
);
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
=
AtlComModuleGetClassObject
(
&
module
,
&
GUID_NULL
,
&
IID_NULL
,
&
ret
);
ok
(
hr
==
CLASS_E_CLASSNOTAVAILABLE
,
"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
=
AtlComModuleGetClassObject
(
&
module
,
&
GUID_NULL
,
&
IID_NULL
,
&
ret
);
ok
(
hr
==
CLASS_E_CLASSNOTAVAILABLE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
START_TEST
(
atl
)
{
if
(
!
register_class
())
...
...
@@ -1077,6 +1103,7 @@ START_TEST(atl)
test_ax_win
();
test_AtlAxAttachControl
();
test_AtlAxCreateControl
();
test_AtlComModuleGetClassObject
();
CoUninitialize
();
}
dlls/atl110/tests/Makefile.in
0 → 100644
View file @
5739db59
TESTDLL
=
atl110.dll
IMPORTS
=
uuid ole32 atl110
EXTRADEFS
=
-D_ATL_VER
=
_ATL_VER_110
C_SRCS
=
\
atl.c
dlls/atl110/tests/atl.c
0 → 100644
View file @
5739db59
/*
* Copyright 2022 Zhiyi Zhang for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#define CONST_VTABLE
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <atlbase.h>
#include <wine/test.h>
static
void
test_AtlComModuleGetClassObject
(
void
)
{
_ATL_OBJMAP_ENTRY_EX
*
null_entry
=
NULL
;
_ATL_COM_MODULE
module
;
HRESULT
hr
;
void
*
ret
;
/* Test NULL module */
hr
=
AtlComModuleGetClassObject
(
NULL
,
&
GUID_NULL
,
&
IID_NULL
,
&
ret
);
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
=
AtlComModuleGetClassObject
(
&
module
,
&
GUID_NULL
,
&
IID_NULL
,
&
ret
);
ok
(
hr
==
CLASS_E_CLASSNOTAVAILABLE
,
"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
=
AtlComModuleGetClassObject
(
&
module
,
&
GUID_NULL
,
&
IID_NULL
,
&
ret
);
ok
(
hr
==
CLASS_E_CLASSNOTAVAILABLE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
START_TEST
(
atl
)
{
CoInitialize
(
NULL
);
test_AtlComModuleGetClassObject
();
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