-
Notifications
You must be signed in to change notification settings - Fork 264
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
suspicious UNINITIALIZED READ warning when calling GetKeyNameTextW #1819
Comments
From MSDN: "If the function fails, the return value is zero. " On Wed, Nov 18, 2015 at 6:05 PM, mistmist notifications@github.com wrote:
|
On my system return value is 4 and the buffer contains "CTRL" plus a null character (as the "return 2" branch is taken). Hope that the key code does not depend on the Windows keyboard layout setting, for the record here it's En-IE but if i switch to En-US layout i get the same. |
DrMemory 1.9.0-4 32-bit complains about UNINITIALIZED READ on the instruction "test %ecx %ecx" corresponding to the *pW test in the while loop, on the last iteration. GetKeyNameTextW() is documented to null-terminate the buffer, so either it has a bug and doesn't do that, or DrMemory has a bug and falsely reports an error. Either way it can be avoided by checking the end position first. DynamoRIO/drmemory#1819 Change-Id: I546d2057d39865d527c1d7c436f690669b214d75
The entry seems to not include the null, explaining the false positive:
|
The kernel writes terminating null but returns only the non-null count. |
Not sure if this is a bug in DrMemory, but i'm getting this surprising warning: according to MSDN the GetKeyNameTextW should write a null terminator at buf[ret] but DrMemory 1.9.0-4 (32-bit) says that there's a UNINITIALIZED READ on the "if (buf[ret])". (The key in the example is "CTRL")
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646300%28v=vs.120%29.aspx
Build the following program with Visual Studio 2013:
Running it with "drmemory.exe foo.exe" on Windows 7:
Running it with "-light" reports no error.
"-debug -dr_debug -pause_at_assert" does not print anything interesting.
The text was updated successfully, but these errors were encountered: