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
653c4140
Commit
653c4140
authored
Mar 10, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Added an exception handler to catch bad pointers in X11DRV_SetImageBits.
parent
5953a86a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
70 deletions
+81
-70
dib.c
dlls/winex11.drv/dib.c
+81
-70
No files found.
dlls/winex11.drv/dib.c
View file @
653c4140
...
...
@@ -39,7 +39,7 @@
#include "winbase.h"
#include "wingdi.h"
#include "x11drv.h"
#include "
excpt
.h"
#include "
wine/exception
.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
bitmap
);
...
...
@@ -3539,65 +3539,74 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
bmpImage
->
red_mask
,
bmpImage
->
green_mask
,
bmpImage
->
blue_mask
);
/* Transfer the pixels */
switch
(
descr
->
infoBpp
)
__TRY
{
case
1
:
X11DRV_DIB_SetImageBits_1
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
,
descr
->
dibpitch
);
break
;
case
4
:
if
(
descr
->
compression
)
{
X11DRV_DIB_SetImageBits_GetSubImage
(
descr
,
bmpImage
);
X11DRV_DIB_SetImageBits_RLE4
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
);
}
else
X11DRV_DIB_SetImageBits_4
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
,
descr
->
dibpitch
);
break
;
case
8
:
if
(
descr
->
compression
)
{
X11DRV_DIB_SetImageBits_GetSubImage
(
descr
,
bmpImage
);
X11DRV_DIB_SetImageBits_RLE8
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
);
}
else
X11DRV_DIB_SetImageBits_8
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
,
descr
->
dibpitch
);
break
;
case
15
:
case
16
:
X11DRV_DIB_SetImageBits_16
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
descr
->
physDev
,
descr
->
rMask
,
descr
->
gMask
,
descr
->
bMask
,
bmpImage
,
descr
->
dibpitch
);
break
;
case
24
:
X11DRV_DIB_SetImageBits_24
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
descr
->
physDev
,
descr
->
rMask
,
descr
->
gMask
,
descr
->
bMask
,
bmpImage
,
descr
->
dibpitch
);
break
;
case
32
:
X11DRV_DIB_SetImageBits_32
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
descr
->
physDev
,
descr
->
rMask
,
descr
->
gMask
,
descr
->
bMask
,
bmpImage
,
descr
->
dibpitch
);
break
;
default:
WARN
(
"(%d): Invalid depth
\n
"
,
descr
->
infoBpp
);
break
;
switch
(
descr
->
infoBpp
)
{
case
1
:
X11DRV_DIB_SetImageBits_1
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
,
descr
->
dibpitch
);
break
;
case
4
:
if
(
descr
->
compression
)
{
X11DRV_DIB_SetImageBits_GetSubImage
(
descr
,
bmpImage
);
X11DRV_DIB_SetImageBits_RLE4
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
);
}
else
X11DRV_DIB_SetImageBits_4
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
,
descr
->
dibpitch
);
break
;
case
8
:
if
(
descr
->
compression
)
{
X11DRV_DIB_SetImageBits_GetSubImage
(
descr
,
bmpImage
);
X11DRV_DIB_SetImageBits_RLE8
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
);
}
else
X11DRV_DIB_SetImageBits_8
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
(
int
*
)(
descr
->
colorMap
),
bmpImage
,
descr
->
dibpitch
);
break
;
case
15
:
case
16
:
X11DRV_DIB_SetImageBits_16
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
descr
->
physDev
,
descr
->
rMask
,
descr
->
gMask
,
descr
->
bMask
,
bmpImage
,
descr
->
dibpitch
);
break
;
case
24
:
X11DRV_DIB_SetImageBits_24
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
descr
->
physDev
,
descr
->
rMask
,
descr
->
gMask
,
descr
->
bMask
,
bmpImage
,
descr
->
dibpitch
);
break
;
case
32
:
X11DRV_DIB_SetImageBits_32
(
descr
->
lines
,
descr
->
bits
,
descr
->
infoWidth
,
descr
->
width
,
descr
->
xSrc
,
descr
->
physDev
,
descr
->
rMask
,
descr
->
gMask
,
descr
->
bMask
,
bmpImage
,
descr
->
dibpitch
);
break
;
default:
WARN
(
"(%d): Invalid depth
\n
"
,
descr
->
infoBpp
);
break
;
}
}
__EXCEPT_PAGE_FAULT
{
WARN
(
"invalid bits pointer %p
\n
"
,
descr
->
bits
);
lines
=
0
;
}
__ENDTRY
TRACE
(
"XPutImage(%ld,%p,%p,%d,%d,%d,%d,%d,%d)
\n
"
,
descr
->
drawable
,
descr
->
gc
,
bmpImage
,
...
...
@@ -3605,20 +3614,22 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
descr
->
width
,
descr
->
height
);
wine_tsx11_lock
();
#ifdef HAVE_LIBXXSHM
if
(
descr
->
image
&&
descr
->
useShm
)
if
(
lines
)
{
XShmPutImage
(
gdi_display
,
descr
->
drawable
,
descr
->
gc
,
bmpImage
,
descr
->
xSrc
,
descr
->
ySrc
,
descr
->
xDest
,
descr
->
yDest
,
descr
->
width
,
descr
->
height
,
FALSE
);
XSync
(
gdi_display
,
0
);
}
else
#ifdef HAVE_LIBXXSHM
if
(
descr
->
image
&&
descr
->
useShm
)
{
XShmPutImage
(
gdi_display
,
descr
->
drawable
,
descr
->
gc
,
bmpImage
,
descr
->
xSrc
,
descr
->
ySrc
,
descr
->
xDest
,
descr
->
yDest
,
descr
->
width
,
descr
->
height
,
FALSE
);
XSync
(
gdi_display
,
0
);
}
else
#endif
XPutImage
(
gdi_display
,
descr
->
drawable
,
descr
->
gc
,
bmpImage
,
descr
->
xSrc
,
descr
->
ySrc
,
descr
->
xDest
,
descr
->
yDest
,
descr
->
width
,
descr
->
height
);
XPutImage
(
gdi_display
,
descr
->
drawable
,
descr
->
gc
,
bmpImage
,
descr
->
xSrc
,
descr
->
ySrc
,
descr
->
xDest
,
descr
->
yDest
,
descr
->
width
,
descr
->
height
);
}
if
(
!
descr
->
image
)
XDestroyImage
(
bmpImage
);
wine_tsx11_unlock
();
return
lines
;
...
...
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