From 20f44981dd66bf6ce0d504a0f42591ffac7eefbc Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Tue, 25 Feb 2020 23:43:33 +0800 Subject: [PATCH] fix a old bug in load_cursor_from_mem: imageh must be 64 --- src/kernel/cursor-comm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kernel/cursor-comm.c b/src/kernel/cursor-comm.c index 4f2335b8..b68c4111 100644 --- a/src/kernel/cursor-comm.c +++ b/src/kernel/cursor-comm.c @@ -156,7 +156,7 @@ static HCURSOR load_cursor_from_mem (const void* area) #if 0 DWORD32 size; #endif - DWORD32 offset, imagesize, imagew, imageh; + DWORD32 offset = 0, imagesize = 0, imagew = 0, imageh = 0; p += sizeof (WORD16); wTemp = MGUI_ReadLE16Mem (&p); @@ -189,7 +189,7 @@ static HCURSOR load_cursor_from_mem (const void* area) p += sizeof (DWORD32); imagew = MGUI_ReadLE32Mem (&p); imageh = MGUI_ReadLE32Mem (&p); - if (imagew > 32 || imageh > 32) { + if (imagew != CURSORWIDTH || imageh != (CURSORHEIGHT*2)) { goto error; } @@ -213,7 +213,9 @@ static HCURSOR load_cursor_from_mem (const void* area) p + (imagesize - MONOSIZE), p, colornum); error: - _WRN_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p\n", area); + _WRN_PRINTF ("LoadCursorFromMem: failed when loading cursor from %p: " + "w(%d), h(%d), xhot(%d), yhot(%d), imagew(%d), imageh(%d), colornum(%d)\n", + area, w, h, xhot, yhot, (int)imagew, (int)imageh, colornum); return 0; }