Commit ee1880a7 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

gdi32/tests: Zero initialize DEVMODE before passing it to EnumDisplaySettings().

Zero initialize DEVMODE before passing it to EnumDisplaySettings(), which may write beyond the end of the DEVMODE structure on Windows because the dmDriverExtra field is uninitialized. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent c3bd08b0
......@@ -242,6 +242,8 @@ static void test_GdiConvertToDevmodeW(void)
return;
}
memset(&dmA, 0, sizeof(dmA));
dmA.dmSize = sizeof(dmA);
ret = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA);
ok(ret, "EnumDisplaySettingsExA error %u\n", GetLastError());
ok(dmA.dmSize >= FIELD_OFFSET(DEVMODEA, dmICMMethod), "dmSize is too small: %04x\n", dmA.dmSize);
......@@ -591,6 +593,8 @@ static void test_CreateCompatibleDC(void)
bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
bRet = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
ok(bRet, "EnumDisplaySettingsEx failed\n");
dm.u1.s1.dmScale = 200;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment