user32: Check for valid pointer in CreateIconFromResource.
This commit is contained in:
parent
e4bb3ae755
commit
9f0f17f853
|
@ -1064,8 +1064,6 @@ static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
|
|||
|
||||
TRACE("bits %p, bits_size %d\n", bits, bits_size);
|
||||
|
||||
if (!bits) return 0;
|
||||
|
||||
riff_find_chunk( ANI_ACON_ID, ANI_RIFF_ID, &root_chunk, &ACON_chunk );
|
||||
if (!ACON_chunk.data)
|
||||
{
|
||||
|
@ -1104,6 +1102,7 @@ static HCURSOR CURSORICON_CreateIconFromANI( const LPBYTE bits, DWORD bits_size,
|
|||
width, height, depth );
|
||||
|
||||
frame_bits = HeapAlloc( GetProcessHeap(), 0, entry->dwDIBSize );
|
||||
if (!frame_bits) return 0;
|
||||
memcpy( frame_bits, icon_data + entry->dwDIBOffset, entry->dwDIBSize );
|
||||
|
||||
if (!header.width || !header.height)
|
||||
|
@ -1142,6 +1141,8 @@ HICON WINAPI CreateIconFromResourceEx( LPBYTE bits, UINT cbSize,
|
|||
bits, cbSize, dwVersion, width, height,
|
||||
bIcon ? "icon" : "cursor", (cFlag & LR_MONOCHROME) ? "mono" : "" );
|
||||
|
||||
if (!bits) return 0;
|
||||
|
||||
if (bIcon)
|
||||
{
|
||||
hotspot.x = width / 2;
|
||||
|
|
|
@ -1005,6 +1005,11 @@ static void test_CreateIconFromResource(void)
|
|||
error = GetLastError();
|
||||
ok(error == 0xdeadbeef, "Last error: %u\n", error);
|
||||
|
||||
/* Rejection of NULL pointer crashes at least on WNT4WSSP6, W2KPROSP4, WXPPROSP3
|
||||
*
|
||||
* handle = CreateIconFromResource(NULL, ICON_RES_SIZE, TRUE, 0x00030000);
|
||||
* ok(handle == NULL, "Invalid pointer accepted (%p)\n", handle);
|
||||
*/
|
||||
HeapFree(GetProcessHeap(), 0, hotspot);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue