Commit 653c4140 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Added an exception handler to catch bad pointers in X11DRV_SetImageBits.

parent 5953a86a
......@@ -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,6 +3539,8 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask);
/* Transfer the pixels */
__TRY
{
switch(descr->infoBpp)
{
case 1:
......@@ -3598,6 +3600,13 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
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,6 +3614,8 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
descr->width, descr->height);
wine_tsx11_lock();
if (lines)
{
#ifdef HAVE_LIBXXSHM
if (descr->image && descr->useShm)
{
......@@ -3618,7 +3629,7 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment