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
9a72a865
Commit
9a72a865
authored
Aug 28, 2007
by
Mikolaj Zalewski
Committed by
Alexandre Julliard
Aug 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Test for out-of-bound src coordinates in GdiAlphaBlend.
parent
74cd76c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
bitmap.c
dlls/gdi32/tests/bitmap.c
+65
-0
xrender.c
dlls/winex11.drv/xrender.c
+8
-0
No files found.
dlls/gdi32/tests/bitmap.c
View file @
9a72a865
...
...
@@ -31,6 +31,8 @@
#include "wine/test.h"
#define expect_eq(expr, value, type, format) { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }
static
BOOL
is_win9x
;
static
INT
BITMAP_GetWidthBytes
(
INT
bmWidth
,
INT
bpp
)
...
...
@@ -1830,6 +1832,68 @@ static void test_get16dibits(void)
ReleaseDC
(
NULL
,
screen_dc
);
}
void
test_GdiAlphaBlend
()
{
/* test out-of-bound parameters for GdiAlphaBlend */
HDC
hdcNull
=
GetDC
(
NULL
);
HDC
hdcDst
=
CreateCompatibleDC
(
hdcNull
);
HBITMAP
bmpDst
=
CreateCompatibleBitmap
(
hdcNull
,
100
,
100
);
HBITMAP
oldDst
;
BITMAPINFO
bmi
;
HDC
hdcSrc
=
CreateCompatibleDC
(
hdcNull
);
HBITMAP
bmpSrc
;
HBITMAP
oldSrc
;
LPVOID
bits
;
BLENDFUNCTION
blend
;
memset
(
&
bmi
,
0
,
sizeof
(
bmi
));
/* as of Wine 0.9.44 we require the src to be a DIB section */
bmi
.
bmiHeader
.
biSize
=
sizeof
(
bmi
.
bmiHeader
);
bmi
.
bmiHeader
.
biHeight
=
20
;
bmi
.
bmiHeader
.
biWidth
=
20
;
bmi
.
bmiHeader
.
biBitCount
=
32
;
bmi
.
bmiHeader
.
biPlanes
=
1
;
bmi
.
bmiHeader
.
biCompression
=
BI_RGB
;
bmpSrc
=
CreateDIBSection
(
hdcDst
,
&
bmi
,
DIB_RGB_COLORS
,
&
bits
,
NULL
,
0
);
ok
(
bmpSrc
!=
NULL
,
"Couldn't create source bitmap
\n
"
);
oldDst
=
(
HBITMAP
)
SelectObject
(
hdcDst
,
bmpDst
);
oldSrc
=
(
HBITMAP
)
SelectObject
(
hdcSrc
,
bmpSrc
);
blend
.
BlendOp
=
AC_SRC_OVER
;
blend
.
BlendFlags
=
0
;
blend
.
SourceConstantAlpha
=
128
;
blend
.
AlphaFormat
=
0
;
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
0
,
0
,
20
,
20
,
blend
),
TRUE
,
BOOL
,
"%d"
);
SetLastError
(
0xdeadbeef
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
-
1
,
0
,
10
,
10
,
blend
),
FALSE
,
BOOL
,
"%d"
);
expect_eq
(
GetLastError
(),
ERROR_INVALID_PARAMETER
,
int
,
"%d"
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
0
,
-
1
,
10
,
10
,
blend
),
FALSE
,
BOOL
,
"%d"
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
15
,
0
,
10
,
10
,
blend
),
FALSE
,
BOOL
,
"%d"
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
10
,
10
,
-
2
,
3
,
blend
),
FALSE
,
BOOL
,
"%d"
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
10
,
10
,
-
2
,
3
,
blend
),
FALSE
,
BOOL
,
"%d"
);
SetWindowOrgEx
(
hdcSrc
,
-
10
,
-
10
,
NULL
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
-
1
,
0
,
10
,
10
,
blend
),
TRUE
,
BOOL
,
"%d"
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
0
,
-
1
,
10
,
10
,
blend
),
TRUE
,
BOOL
,
"%d"
);
SetMapMode
(
hdcSrc
,
MM_ANISOTROPIC
);
ScaleWindowExtEx
(
hdcSrc
,
10
,
1
,
10
,
1
,
NULL
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
-
1
,
0
,
30
,
30
,
blend
),
TRUE
,
BOOL
,
"%d"
);
expect_eq
(
GdiAlphaBlend
(
hdcDst
,
0
,
0
,
20
,
20
,
hdcSrc
,
0
,
-
1
,
30
,
30
,
blend
),
TRUE
,
BOOL
,
"%d"
);
SelectObject
(
hdcDst
,
oldDst
);
SelectObject
(
hdcSrc
,
oldSrc
);
DeleteObject
(
bmpSrc
);
DeleteObject
(
bmpDst
);
DeleteDC
(
hdcDst
);
DeleteDC
(
hdcSrc
);
ReleaseDC
(
NULL
,
hdcNull
);
}
START_TEST
(
bitmap
)
{
...
...
@@ -1848,6 +1912,7 @@ START_TEST(bitmap)
test_GetDIBits
();
test_select_object
();
test_CreateBitmap
();
test_GdiAlphaBlend
();
test_bitmapinfoheadersize
();
test_get16dibits
();
}
dlls/winex11.drv/xrender.c
View file @
9a72a865
...
...
@@ -1572,6 +1572,14 @@ BOOL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst,
return
FALSE
;
}
if
(
xSrc
<
0
||
ySrc
<
0
||
widthSrc
<
0
||
heightSrc
<
0
||
xSrc
+
widthSrc
>
dib
.
dsBmih
.
biWidth
||
ySrc
+
heightSrc
>
abs
(
dib
.
dsBmih
.
biHeight
))
{
WARN
(
"Invalid src coords: (%d,%d), size %dx%d
\n
"
,
xSrc
,
ySrc
,
widthSrc
,
heightSrc
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
dib
.
dsBm
.
bmBitsPixel
!=
32
)
{
FIXME
(
"not a 32 bpp dibsection
\n
"
);
return
FALSE
;
...
...
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