Author: gschneider
Date: Sun Sep 28 14:42:03 2008
New Revision: 36578
URL:
http://svn.reactos.org/svn/reactos?rev=36578&view=rev
Log:
Handle PALETTE_LockPalette returning NULL.
Fixes Coverity CIDs 486 and 487.
Modified:
trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Sun Sep 28
14:42:03 2008
@@ -62,6 +62,13 @@
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
+ if (PalGDI == NULL)
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ DC_UnlockDc(dc);
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return 0;
+ }
for (Index = StartIndex;
Index < StartIndex + Entries && Index < PalGDI->NumColors;
@@ -120,6 +127,13 @@
Entries = (1 << BitmapObj->dib->dsBmih.biBitCount) - StartIndex;
PalGDI = PALETTE_LockPalette(BitmapObj->hDIBPalette);
+ if (PalGDI == NULL)
+ {
+ BITMAPOBJ_UnlockBitmap(BitmapObj);
+ DC_UnlockDc(dc);
+ SetLastWin32Error(ERROR_INVALID_HANDLE);
+ return 0;
+ }
for (Index = StartIndex;
Index < StartIndex + Entries && Index < PalGDI->NumColors;