wgl: Initialize DEVMODE struct

Otherwise the dmDriverExtra field might be uninitialized and have a nonzero
value, which can cause the API implementation to smash the stack when copying
to the output struct.

Cc: mesa-stable
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27998>
(cherry picked from commit 788c106ea1)
This commit is contained in:
Jesse Natalie 2024-03-05 13:09:48 -08:00 committed by Eric Engestrom
parent cb69a13079
commit 5ce799b576
2 changed files with 2 additions and 2 deletions

View file

@ -894,7 +894,7 @@
"description": "wgl: Initialize DEVMODE struct",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -74,7 +74,7 @@ static int
get_refresh_rate(void)
{
#ifndef _GAMING_XBOX
DEVMODE devModes;
DEVMODE devModes = { .dmSize = sizeof(DEVMODE) };
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devModes)) {
/* clamp the value, just in case we get garbage */