From e5bf20d8653617ff254f680fcec69de108f4046c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 24 Apr 2026 12:29:39 +0300 Subject: [PATCH] [USER32_APITEST] Fix stack corruption Found by /RTC1 --- modules/rostests/apitests/user32/LoadImage.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/rostests/apitests/user32/LoadImage.c b/modules/rostests/apitests/user32/LoadImage.c index 80ffa27d0c0..55e35d075eb 100644 --- a/modules/rostests/apitests/user32/LoadImage.c +++ b/modules/rostests/apitests/user32/LoadImage.c @@ -9,7 +9,11 @@ static void test_LoadImage_1bpp(void) HDC hdc1, hdc2; HBITMAP hBmp1, hBmp2; BITMAP bitmap1, bitmap2; - BITMAPINFO bmi; + struct + { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[256]; + } bmi; UINT size; HGLOBAL hMem; LPVOID lpBits; @@ -47,7 +51,7 @@ static void test_LoadImage_1bpp(void) hMem = GlobalAlloc(GMEM_MOVEABLE, size); lpBits = GlobalLock(hMem); - result = GetDIBits(hdc1, hBmp1, 0, bitmap1.bmHeight, lpBits, &bmi, DIB_RGB_COLORS); + result = GetDIBits(hdc1, hBmp1, 0, bitmap1.bmHeight, lpBits, (PBITMAPINFO)&bmi, DIB_RGB_COLORS); if (!result) { skip("GetDIBits failed for 1 BPP bitmap\n"); @@ -104,7 +108,7 @@ static void test_LoadImage_1bpp(void) size = ((bitmap2.bmWidth * bitmap2.bmBitsPixel + 31) / 32) * 4 * bitmap2.bmHeight; ok(size == 16, "Expected 16, but size is %d\n", size); - result = GetDIBits(hdc2, hBmp2, 0, bitmap2.bmHeight, lpBits, &bmi, DIB_RGB_COLORS); // Check for success per Timo + result = GetDIBits(hdc2, hBmp2, 0, bitmap2.bmHeight, lpBits, (PBITMAPINFO)&bmi, DIB_RGB_COLORS); // Check for success per Timo if (!result) { skip("GetDIBits failed for 1 BPP bitmap\n");