winex11: Added an exception handler to catch bad pointers in X11DRV_SetImageBits.
This commit is contained in:
parent
5953a86ab1
commit
653c4140b4
|
@ -39,7 +39,7 @@
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "x11drv.h"
|
#include "x11drv.h"
|
||||||
#include "excpt.h"
|
#include "wine/exception.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(bitmap);
|
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);
|
bmpImage->red_mask,bmpImage->green_mask,bmpImage->blue_mask);
|
||||||
|
|
||||||
/* Transfer the pixels */
|
/* Transfer the pixels */
|
||||||
switch(descr->infoBpp)
|
__TRY
|
||||||
{
|
{
|
||||||
case 1:
|
switch(descr->infoBpp)
|
||||||
X11DRV_DIB_SetImageBits_1( descr->lines, descr->bits, descr->infoWidth,
|
{
|
||||||
descr->width, descr->xSrc, (int *)(descr->colorMap),
|
case 1:
|
||||||
bmpImage, descr->dibpitch );
|
X11DRV_DIB_SetImageBits_1( descr->lines, descr->bits, descr->infoWidth,
|
||||||
break;
|
descr->width, descr->xSrc, (int *)(descr->colorMap),
|
||||||
case 4:
|
bmpImage, descr->dibpitch );
|
||||||
if (descr->compression) {
|
break;
|
||||||
X11DRV_DIB_SetImageBits_GetSubImage( descr, bmpImage);
|
case 4:
|
||||||
X11DRV_DIB_SetImageBits_RLE4( descr->lines, descr->bits,
|
if (descr->compression) {
|
||||||
descr->infoWidth, descr->width,
|
X11DRV_DIB_SetImageBits_GetSubImage( descr, bmpImage);
|
||||||
descr->xSrc, (int *)(descr->colorMap),
|
X11DRV_DIB_SetImageBits_RLE4( descr->lines, descr->bits,
|
||||||
bmpImage );
|
descr->infoWidth, descr->width,
|
||||||
} else
|
descr->xSrc, (int *)(descr->colorMap),
|
||||||
X11DRV_DIB_SetImageBits_4( descr->lines, descr->bits,
|
bmpImage );
|
||||||
descr->infoWidth, descr->width,
|
} else
|
||||||
descr->xSrc, (int*)(descr->colorMap),
|
X11DRV_DIB_SetImageBits_4( descr->lines, descr->bits,
|
||||||
bmpImage, descr->dibpitch );
|
descr->infoWidth, descr->width,
|
||||||
break;
|
descr->xSrc, (int*)(descr->colorMap),
|
||||||
case 8:
|
bmpImage, descr->dibpitch );
|
||||||
if (descr->compression) {
|
break;
|
||||||
X11DRV_DIB_SetImageBits_GetSubImage( descr, bmpImage);
|
case 8:
|
||||||
X11DRV_DIB_SetImageBits_RLE8( descr->lines, descr->bits,
|
if (descr->compression) {
|
||||||
descr->infoWidth, descr->width,
|
X11DRV_DIB_SetImageBits_GetSubImage( descr, bmpImage);
|
||||||
descr->xSrc, (int *)(descr->colorMap),
|
X11DRV_DIB_SetImageBits_RLE8( descr->lines, descr->bits,
|
||||||
bmpImage );
|
descr->infoWidth, descr->width,
|
||||||
} else
|
descr->xSrc, (int *)(descr->colorMap),
|
||||||
X11DRV_DIB_SetImageBits_8( descr->lines, descr->bits,
|
bmpImage );
|
||||||
descr->infoWidth, descr->width,
|
} else
|
||||||
descr->xSrc, (int *)(descr->colorMap),
|
X11DRV_DIB_SetImageBits_8( descr->lines, descr->bits,
|
||||||
bmpImage, descr->dibpitch );
|
descr->infoWidth, descr->width,
|
||||||
break;
|
descr->xSrc, (int *)(descr->colorMap),
|
||||||
case 15:
|
bmpImage, descr->dibpitch );
|
||||||
case 16:
|
break;
|
||||||
X11DRV_DIB_SetImageBits_16( descr->lines, descr->bits,
|
case 15:
|
||||||
descr->infoWidth, descr->width,
|
case 16:
|
||||||
descr->xSrc, descr->physDev,
|
X11DRV_DIB_SetImageBits_16( descr->lines, descr->bits,
|
||||||
descr->rMask, descr->gMask, descr->bMask,
|
descr->infoWidth, descr->width,
|
||||||
bmpImage, descr->dibpitch);
|
descr->xSrc, descr->physDev,
|
||||||
break;
|
descr->rMask, descr->gMask, descr->bMask,
|
||||||
case 24:
|
bmpImage, descr->dibpitch);
|
||||||
X11DRV_DIB_SetImageBits_24( descr->lines, descr->bits,
|
break;
|
||||||
descr->infoWidth, descr->width,
|
case 24:
|
||||||
descr->xSrc, descr->physDev,
|
X11DRV_DIB_SetImageBits_24( descr->lines, descr->bits,
|
||||||
descr->rMask, descr->gMask, descr->bMask,
|
descr->infoWidth, descr->width,
|
||||||
bmpImage, descr->dibpitch);
|
descr->xSrc, descr->physDev,
|
||||||
break;
|
descr->rMask, descr->gMask, descr->bMask,
|
||||||
case 32:
|
bmpImage, descr->dibpitch);
|
||||||
X11DRV_DIB_SetImageBits_32( descr->lines, descr->bits,
|
break;
|
||||||
descr->infoWidth, descr->width,
|
case 32:
|
||||||
descr->xSrc, descr->physDev,
|
X11DRV_DIB_SetImageBits_32( descr->lines, descr->bits,
|
||||||
descr->rMask, descr->gMask, descr->bMask,
|
descr->infoWidth, descr->width,
|
||||||
bmpImage, descr->dibpitch);
|
descr->xSrc, descr->physDev,
|
||||||
break;
|
descr->rMask, descr->gMask, descr->bMask,
|
||||||
default:
|
bmpImage, descr->dibpitch);
|
||||||
WARN("(%d): Invalid depth\n", descr->infoBpp );
|
break;
|
||||||
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",
|
TRACE("XPutImage(%ld,%p,%p,%d,%d,%d,%d,%d,%d)\n",
|
||||||
descr->drawable, descr->gc, bmpImage,
|
descr->drawable, descr->gc, bmpImage,
|
||||||
|
@ -3605,20 +3614,22 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
|
||||||
descr->width, descr->height);
|
descr->width, descr->height);
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
#ifdef HAVE_LIBXXSHM
|
if (lines)
|
||||||
if (descr->image && descr->useShm)
|
|
||||||
{
|
{
|
||||||
XShmPutImage( gdi_display, descr->drawable, descr->gc, bmpImage,
|
#ifdef HAVE_LIBXXSHM
|
||||||
descr->xSrc, descr->ySrc, descr->xDest, descr->yDest,
|
if (descr->image && descr->useShm)
|
||||||
descr->width, descr->height, FALSE );
|
{
|
||||||
XSync( gdi_display, 0 );
|
XShmPutImage( gdi_display, descr->drawable, descr->gc, bmpImage,
|
||||||
}
|
descr->xSrc, descr->ySrc, descr->xDest, descr->yDest,
|
||||||
else
|
descr->width, descr->height, FALSE );
|
||||||
|
XSync( gdi_display, 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
XPutImage( gdi_display, descr->drawable, descr->gc, bmpImage,
|
XPutImage( gdi_display, descr->drawable, descr->gc, bmpImage,
|
||||||
descr->xSrc, descr->ySrc, descr->xDest, descr->yDest,
|
descr->xSrc, descr->ySrc, descr->xDest, descr->yDest,
|
||||||
descr->width, descr->height );
|
descr->width, descr->height );
|
||||||
|
}
|
||||||
if (!descr->image) XDestroyImage( bmpImage );
|
if (!descr->image) XDestroyImage( bmpImage );
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
return lines;
|
return lines;
|
||||||
|
|
Loading…
Reference in New Issue