New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Applied ZeroMemory to DEVMODE struct in Win32 to prevent Uninitialized… #1264
Conversation
I ran Dr. Memory myself with a modified version of the opengl example, to use fullscreen. But while I see the Before this PR
After this PR
As such, I wonder whether just zero-ing everything is the best option? Additionally I noticed another uninitialized read for the |
For both the The same two fields as above also have to be set when calling |
For
I get the |
From http://drmemory.org/docs/page_uninit.html:
Because user mode applications (including Dr. Memory) can't peek inside kernel mode execution to determine what is and isn't done with memory, Dr. Memory simply assumes that the entire structure is going to be read. In the case of This however doesn't change the fact that we are still missing setting |
Thanks, that was informative. Reverted |
Can you squash the two commits? |
… Read. Set dmDriverExtra for EnumDisplaySettings. Reverted unneeded ZeroMemory for DEVMODE.
Merged in 23a3455 |
… Read.
While working on my game, I ran my executable through Dr.Memory to keep an eye on memory issues. I noticed an Uninitialized Read error being reported where the DEVMODE struct is being used, particularly under the Win32 switchToFullscreen method. I ran the DEVMODE struct through ZeroMemory and it corrected the issue.
Microsoft's DEVMODE documentation states that many of the struct members need to be initialized to something. I browsed the display code of a few other projects, and running DEVMODE through ZeroMemory is common practice.