Commit 77448f58 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Perform sanity checks on the rectangle in LockRect.

parent 2abfc391
......@@ -348,6 +348,17 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
} else {
TRACE("Lock Rect (%p) = l %ld, t %ld, r %ld, b %ld\n", pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
if ((pRect->top < 0) ||
(pRect->left < 0) ||
(pRect->left >= pRect->right) ||
(pRect->top >= pRect->bottom) ||
(pRect->right > This->currentDesc.Width) ||
(pRect->bottom > This->currentDesc.Height))
{
WARN(" Invalid values in pRect !!!\n");
return D3DERR_INVALIDCALL;
}
if (This->resource.format == WINED3DFMT_DXT1) { /* DXT1 is half byte per pixel */
pLockedRect->pBits = This->resource.allocatedMemory + (pLockedRect->Pitch * pRect->top) + ((pRect->left * This->bytesPerPixel / 2));
} else {
......
......@@ -196,6 +196,17 @@ IWineGDISurfaceImpl_LockRect(IWineD3DSurface *iface,
TRACE("Lock Rect (%p) = l %ld, t %ld, r %ld, b %ld\n",
pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
if ((pRect->top < 0) ||
(pRect->left < 0) ||
(pRect->left >= pRect->right) ||
(pRect->top >= pRect->bottom) ||
(pRect->right > This->currentDesc.Width) ||
(pRect->bottom > This->currentDesc.Height))
{
WARN(" Invalid values in pRect !!!\n");
return D3DERR_INVALIDCALL;
}
if (This->resource.format == WINED3DFMT_DXT1)
{
/* DXT1 is half byte per pixel */
......
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