From 23a345512d042518c9dcfcbc77ff8ebf92a65baf Mon Sep 17 00:00:00 2001 From: Anthony <4023054+anthnich@users.noreply.github.com> Date: Fri, 11 Aug 2017 15:32:44 -0400 Subject: [PATCH] Applied ZeroMemory to DEVMODE struct n Win32 to prevent Uninitialized Read. Set dmDriverExtra for EnumDisplaySettings. Reverted unneeded ZeroMemory for DEVMODE. --- src/SFML/Window/Win32/VideoModeImpl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SFML/Window/Win32/VideoModeImpl.cpp b/src/SFML/Window/Win32/VideoModeImpl.cpp index 87839316..f5939b3c 100644 --- a/src/SFML/Window/Win32/VideoModeImpl.cpp +++ b/src/SFML/Window/Win32/VideoModeImpl.cpp @@ -42,6 +42,7 @@ std::vector VideoModeImpl::getFullscreenModes() // Enumerate all available video modes for the primary display adapter DEVMODE win32Mode; win32Mode.dmSize = sizeof(win32Mode); + win32Mode.dmDriverExtra = 0; for (int count = 0; EnumDisplaySettings(NULL, count, &win32Mode); ++count) { // Convert to sf::VideoMode @@ -61,6 +62,7 @@ VideoMode VideoModeImpl::getDesktopMode() { DEVMODE win32Mode; win32Mode.dmSize = sizeof(win32Mode); + win32Mode.dmDriverExtra = 0; EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &win32Mode); return VideoMode(win32Mode.dmPelsWidth, win32Mode.dmPelsHeight, win32Mode.dmBitsPerPel);