Add some null checking in the Get/SetBitmapBits functions.
This commit is contained in:
parent
090e2d873e
commit
8903e536fb
|
@ -245,6 +245,10 @@ LONG WINAPI GetBitmapBits(
|
||||||
|
|
||||||
if (!bmp) return 0;
|
if (!bmp) return 0;
|
||||||
|
|
||||||
|
/* If the bits vector is null, the function should return the read size */
|
||||||
|
if(bits == NULL)
|
||||||
|
return bmp->bitmap.bmWidthBytes * bmp->bitmap.bmHeight;
|
||||||
|
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
WARN_(bitmap)("(%ld): Negative number of bytes passed???\n", count );
|
WARN_(bitmap)("(%ld): Negative number of bytes passed???\n", count );
|
||||||
count = -count;
|
count = -count;
|
||||||
|
@ -318,7 +322,8 @@ LONG WINAPI SetBitmapBits(
|
||||||
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
|
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
|
||||||
LONG height, ret;
|
LONG height, ret;
|
||||||
|
|
||||||
if (!bmp) return 0;
|
if ((!bmp) || (!bits))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
WARN_(bitmap)("(%ld): Negative number of bytes passed???\n", count );
|
WARN_(bitmap)("(%ld): Negative number of bytes passed???\n", count );
|
||||||
|
|
Loading…
Reference in New Issue