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
807c0172
Commit
807c0172
authored
Aug 27, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Aug 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Avoid reading outside of the allocated surface memory (Valgrind).
parent
b60a2710
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
surface.c
dlls/d3dx9_36/surface.c
+25
-9
No files found.
dlls/d3dx9_36/surface.c
View file @
807c0172
...
@@ -1366,12 +1366,28 @@ static void init_argb_conversion_info(const struct pixel_format_desc *srcformat,
...
@@ -1366,12 +1366,28 @@ static void init_argb_conversion_info(const struct pixel_format_desc *srcformat,
* Extracts the relevant components from the source color and
* Extracts the relevant components from the source color and
* drops the less significant bits if they aren't used by the destination format.
* drops the less significant bits if they aren't used by the destination format.
*/
*/
static
void
get_relevant_argb_components
(
const
struct
argb_conversion_info
*
info
,
DWORD
col
,
DWORD
*
out
)
static
void
get_relevant_argb_components
(
const
struct
argb_conversion_info
*
info
,
const
BYTE
*
col
,
DWORD
*
out
)
{
{
UINT
i
=
0
;
unsigned
int
i
,
j
;
for
(;
i
<
4
;
i
++
)
unsigned
int
component
,
mask
;
if
(
info
->
process_channel
[
i
])
out
[
i
]
=
(
col
&
info
->
srcmask
[
i
])
>>
info
->
srcshift
[
i
];
for
(
i
=
0
;
i
<
4
;
++
i
)
{
if
(
!
info
->
process_channel
[
i
])
continue
;
component
=
0
;
mask
=
info
->
srcmask
[
i
];
for
(
j
=
0
;
j
<
4
&&
mask
;
++
j
)
{
if
(
info
->
srcshift
[
i
]
<
j
*
8
)
component
|=
(
col
[
j
]
&
mask
)
<<
(
j
*
8
-
info
->
srcshift
[
i
]);
else
component
|=
(
col
[
j
]
&
mask
)
>>
(
info
->
srcshift
[
i
]
-
j
*
8
);
mask
>>=
8
;
}
out
[
i
]
=
component
;
}
}
}
/************************************************************
/************************************************************
...
@@ -1549,14 +1565,14 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit
...
@@ -1549,14 +1565,14 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit
{
{
DWORD
val
;
DWORD
val
;
get_relevant_argb_components
(
&
conv_info
,
*
(
DWORD
*
)
src_ptr
,
channels
);
get_relevant_argb_components
(
&
conv_info
,
src_ptr
,
channels
);
val
=
make_argb_color
(
&
conv_info
,
channels
);
val
=
make_argb_color
(
&
conv_info
,
channels
);
if
(
color_key
)
if
(
color_key
)
{
{
DWORD
ck_pixel
;
DWORD
ck_pixel
;
get_relevant_argb_components
(
&
ck_conv_info
,
*
(
DWORD
*
)
src_ptr
,
channels
);
get_relevant_argb_components
(
&
ck_conv_info
,
src_ptr
,
channels
);
ck_pixel
=
make_argb_color
(
&
ck_conv_info
,
channels
);
ck_pixel
=
make_argb_color
(
&
ck_conv_info
,
channels
);
if
(
ck_pixel
==
color_key
)
if
(
ck_pixel
==
color_key
)
val
&=
~
conv_info
.
destmask
[
0
];
val
&=
~
conv_info
.
destmask
[
0
];
...
@@ -1652,14 +1668,14 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
...
@@ -1652,14 +1668,14 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
{
{
DWORD
val
;
DWORD
val
;
get_relevant_argb_components
(
&
conv_info
,
*
(
DWORD
*
)
src_ptr
,
channels
);
get_relevant_argb_components
(
&
conv_info
,
src_ptr
,
channels
);
val
=
make_argb_color
(
&
conv_info
,
channels
);
val
=
make_argb_color
(
&
conv_info
,
channels
);
if
(
color_key
)
if
(
color_key
)
{
{
DWORD
ck_pixel
;
DWORD
ck_pixel
;
get_relevant_argb_components
(
&
ck_conv_info
,
*
(
DWORD
*
)
src_ptr
,
channels
);
get_relevant_argb_components
(
&
ck_conv_info
,
src_ptr
,
channels
);
ck_pixel
=
make_argb_color
(
&
ck_conv_info
,
channels
);
ck_pixel
=
make_argb_color
(
&
ck_conv_info
,
channels
);
if
(
ck_pixel
==
color_key
)
if
(
ck_pixel
==
color_key
)
val
&=
~
conv_info
.
destmask
[
0
];
val
&=
~
conv_info
.
destmask
[
0
];
...
...
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