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
01378c5c
Commit
01378c5c
authored
Sep 19, 2011
by
Francois Gouget
Committed by
Alexandre Julliard
Sep 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Don't crash when getting a bad image list handle.
parent
c46c47cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
imagelist.c
dlls/comctl32/imagelist.c
+12
-1
imagelist.c
dlls/comctl32/tests/imagelist.c
+15
-2
No files found.
dlls/comctl32/imagelist.c
View file @
01378c5c
...
...
@@ -54,6 +54,7 @@
#include "commoncontrols.h"
#include "imagelist.h"
#include "wine/debug.h"
#include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
imagelist
);
...
...
@@ -3587,7 +3588,17 @@ static const IImageListVtbl ImageListImpl_Vtbl = {
static
inline
BOOL
is_valid
(
HIMAGELIST
himl
)
{
return
himl
&&
himl
->
lpVtbl
==
&
ImageListImpl_Vtbl
;
BOOL
valid
;
__TRY
{
valid
=
himl
&&
himl
->
lpVtbl
==
&
ImageListImpl_Vtbl
;
}
__EXCEPT_PAGE_FAULT
{
valid
=
FALSE
;
}
__ENDTRY
return
valid
;
}
/*************************************************************************
...
...
dlls/comctl32/tests/imagelist.c
View file @
01378c5c
...
...
@@ -372,6 +372,8 @@ static void test_add_remove(void)
/* destroy it */
ok
(
ImageList_Destroy
(
himl
),
"destroy imagelist failed
\n
"
);
ok
(
-
1
==
ImageList_AddIcon
((
HIMAGELIST
)
0xdeadbeef
,
hicon1
),
"don't crash on bad handle
\n
"
);
ok
(
DestroyIcon
(
hicon1
),
"icon 1 wasn't deleted
\n
"
);
ok
(
DestroyIcon
(
hicon2
),
"icon 2 wasn't deleted
\n
"
);
ok
(
DestroyIcon
(
hicon3
),
"icon 3 wasn't deleted
\n
"
);
...
...
@@ -381,6 +383,8 @@ static void test_imagecount(void)
{
HIMAGELIST
himl
;
ok
(
0
==
ImageList_GetImageCount
((
HIMAGELIST
)
0xdeadbeef
),
"don't crash on bad handle
\n
"
);
if
(
!
pImageList_SetImageCount
)
{
win_skip
(
"ImageList_SetImageCount not available
\n
"
);
...
...
@@ -451,6 +455,8 @@ static void test_DrawIndirect(void)
ok
(
!
pImageList_DrawIndirect
(
&
imldp
),
"zero hdc succeeded!
\n
"
);
imldp
.
hdcDst
=
hdc
;
ok
(
!
pImageList_DrawIndirect
(
&
imldp
),
"zero himl succeeded!
\n
"
);
imldp
.
himl
=
(
HIMAGELIST
)
0xdeadbeef
;
ok
(
!
pImageList_DrawIndirect
(
&
imldp
),
"bad himl succeeded!
\n
"
);
imldp
.
himl
=
himl
;
REDRAW
(
hwndfortest
);
...
...
@@ -1752,11 +1758,15 @@ static void test_iconsize(void)
ok
(
cy
==
0x1abe11ed
,
"got %d
\n
"
,
cy
);
ImageList_Destroy
(
himl
);
ret
=
ImageList_GetIconSize
((
HIMAGELIST
)
0xdeadbeef
,
&
cx
,
&
cy
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
}
static
void
test_create
(
void
)
static
void
test_create
_destroy
(
void
)
{
HIMAGELIST
himl
;
BOOL
rc
;
/* list with zero or negative image dimensions */
himl
=
ImageList_Create
(
0
,
0
,
ILC_COLOR16
,
0
,
3
);
...
...
@@ -1773,6 +1783,9 @@ static void test_create(void)
himl
=
ImageList_Create
(
-
1
,
16
,
ILC_COLOR16
,
0
,
3
);
ok
(
himl
==
NULL
,
"got %p
\n
"
,
himl
);
rc
=
ImageList_Destroy
((
HIMAGELIST
)
0xdeadbeef
);
ok
(
rc
==
FALSE
,
"ImageList_Destroy(0xdeadbeef) should fail and not crash
\n
"
);
}
static
void
test_IImageList_Clone
(
void
)
...
...
@@ -1912,7 +1925,7 @@ START_TEST(imagelist)
InitCommonControls
();
test_create
();
test_create
_destroy
();
test_hotspot
();
test_add_remove
();
test_imagecount
();
...
...
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