Add some null checking in the Get/SetBitmapBits functions.

This commit is contained in:
Pascal Lessard 1999-05-22 10:39:00 +00:00 committed by Alexandre Julliard
parent 090e2d873e
commit 8903e536fb
1 changed files with 6 additions and 1 deletions

View File

@ -244,6 +244,10 @@ LONG WINAPI GetBitmapBits(
LONG height, ret; LONG height, ret;
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 );
@ -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 );