NtGdiSetDIBitsToDeviceInternal: Check for ScanLines == 0 and clean up exit pathes. Fixes assertion failure in gdi32_winetest:bitmap

svn path=/trunk/; revision=66612
This commit is contained in:
Timo Kreuzer 2015-03-08 22:44:36 +00:00
parent ff14566384
commit cdc2efb241

View file

@ -461,7 +461,7 @@ NtGdiSetDIBitsToDeviceInternal(
{ {
INT ret = 0; INT ret = 0;
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
PDC pDC; PDC pDC = NULL;
HBITMAP hSourceBitmap = NULL, hMaskBitmap = NULL; HBITMAP hSourceBitmap = NULL, hMaskBitmap = NULL;
SURFOBJ *pDestSurf, *pSourceSurf = NULL, *pMaskSurf = NULL; SURFOBJ *pDestSurf, *pSourceSurf = NULL, *pMaskSurf = NULL;
SURFACE *pSurf; SURFACE *pSurf;
@ -493,21 +493,25 @@ NtGdiSetDIBitsToDeviceInternal(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
goto Exit2; goto Exit;
} }
ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan); ScanLines = min(ScanLines, abs(bmi->bmiHeader.biHeight) - StartScan);
if (ScanLines == 0)
{
DPRINT1("ScanLines == 0\n");
goto Exit;
}
pDC = DC_LockDc(hDC); pDC = DC_LockDc(hDC);
if (!pDC) if (!pDC)
{ {
EngSetLastError(ERROR_INVALID_HANDLE); EngSetLastError(ERROR_INVALID_HANDLE);
goto Exit2; goto Exit;
} }
if (pDC->dctype == DC_TYPE_INFO) if (pDC->dctype == DC_TYPE_INFO)
{ {
DC_UnlockDc(pDC);
goto Exit; goto Exit;
} }
@ -637,14 +641,13 @@ Exit:
} }
if (ppalDIB) PALETTE_ShareUnlockPalette(ppalDIB); if (ppalDIB) PALETTE_ShareUnlockPalette(ppalDIB);
if (pSourceSurf) EngUnlockSurface(pSourceSurf); if (pSourceSurf) EngUnlockSurface(pSourceSurf);
if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap); if (hSourceBitmap) EngDeleteSurface((HSURF)hSourceBitmap);
if (pMaskSurf) EngUnlockSurface(pMaskSurf); if (pMaskSurf) EngUnlockSurface(pMaskSurf);
if (hMaskBitmap) EngDeleteSurface((HSURF)hMaskBitmap); if (hMaskBitmap) EngDeleteSurface((HSURF)hMaskBitmap);
DC_UnlockDc(pDC); if (pDC) DC_UnlockDc(pDC);
Exit2:
ExFreePoolWithTag(pbmiSafe, 'pmTG'); ExFreePoolWithTag(pbmiSafe, 'pmTG');
return ret; return ret;
} }