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
a1790df3
Commit
a1790df3
authored
Nov 26, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Nov 26, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add check for NULL pointer in dibdrv_wglDescribePixelFormat.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9f18d217
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
opengl.c
dlls/gdi32/dibdrv/opengl.c
+2
-1
dc.c
dlls/gdi32/tests/dc.c
+27
-1
No files found.
dlls/gdi32/dibdrv/opengl.c
View file @
a1790df3
...
...
@@ -149,7 +149,8 @@ static int dibdrv_wglDescribePixelFormat( HDC hdc, int fmt, UINT size, PIXELFORM
{
int
ret
=
sizeof
(
pixel_formats
)
/
sizeof
(
pixel_formats
[
0
]);
if
(
fmt
<=
0
||
fmt
>
ret
)
return
ret
;
if
(
!
descr
)
return
ret
;
if
(
fmt
<=
0
||
fmt
>
ret
)
return
0
;
if
(
size
<
sizeof
(
*
descr
))
return
0
;
memset
(
descr
,
0
,
sizeof
(
*
descr
)
);
...
...
dlls/gdi32/tests/dc.c
View file @
a1790df3
...
...
@@ -630,11 +630,13 @@ static void test_CreateCompatibleDC(void)
static
void
test_DC_bitmap
(
void
)
{
PIXELFORMATDESCRIPTOR
descr
;
HDC
hdc
,
hdcmem
;
DWORD
bits
[
64
];
HBITMAP
hbmp
,
oldhbmp
;
COLORREF
col
;
int
i
,
bitspixel
;
int
ret
,
ret2
;
/* fill bitmap data with b&w pattern */
for
(
i
=
0
;
i
<
64
;
i
++
)
bits
[
i
]
=
i
&
1
?
0
:
0xffffff
;
...
...
@@ -645,7 +647,31 @@ static void test_DC_bitmap(void)
/* create a memory dc */
hdcmem
=
CreateCompatibleDC
(
hdc
);
ok
(
hdcmem
!=
NULL
,
"CreateCompatibleDC rets %p
\n
"
,
hdcmem
);
/* tests */
/* test DescribePixelFormat with descr == NULL */
ret2
=
DescribePixelFormat
(
hdcmem
,
0
,
sizeof
(
descr
),
NULL
);
ok
(
ret2
>
0
,
"expected ret2 > 0, got %d
\n
"
,
ret2
);
ret
=
DescribePixelFormat
(
hdcmem
,
1
,
sizeof
(
descr
),
NULL
);
ok
(
ret
==
ret2
,
"expected ret == %d, got %d
\n
"
,
ret2
,
ret
);
ret
=
DescribePixelFormat
(
hdcmem
,
0x10000
,
sizeof
(
descr
),
NULL
);
ok
(
ret
==
ret2
,
"expected ret == %d, got %d
\n
"
,
ret2
,
ret
);
/* test DescribePixelFormat with descr != NULL */
memset
(
&
descr
,
0
,
sizeof
(
descr
));
ret
=
DescribePixelFormat
(
hdcmem
,
0
,
sizeof
(
descr
),
&
descr
);
ok
(
ret
==
0
,
"expected ret == 0, got %d
\n
"
,
ret
);
ok
(
descr
.
nSize
==
0
,
"expected descr.nSize == 0, got %d
\n
"
,
descr
.
nSize
);
memset
(
&
descr
,
0
,
sizeof
(
descr
));
ret
=
DescribePixelFormat
(
hdcmem
,
1
,
sizeof
(
descr
),
&
descr
);
ok
(
ret
==
ret2
,
"expected ret == %d, got %d
\n
"
,
ret2
,
ret
);
ok
(
descr
.
nSize
==
sizeof
(
descr
),
"expected desc.nSize == sizeof(descr), got %d
\n
"
,
descr
.
nSize
);
memset
(
&
descr
,
0
,
sizeof
(
descr
));
ret
=
DescribePixelFormat
(
hdcmem
,
0x10000
,
sizeof
(
descr
),
&
descr
);
ok
(
ret
==
0
,
"expected ret == 0, got %d
\n
"
,
ret
);
ok
(
descr
.
nSize
==
0
,
"expected descr.nSize == 0, got %d
\n
"
,
descr
.
nSize
);
/* test monochrome bitmap: should always work */
hbmp
=
CreateBitmap
(
32
,
32
,
1
,
1
,
bits
);
ok
(
hbmp
!=
NULL
,
"CreateBitmap returns %p
\n
"
,
hbmp
);
...
...
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