Kaydet (Commit) fdd958b8 authored tarafından Michael Stahl's avatar Michael Stahl

vcl: reorder loop to avoid DrMemory warning

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.

https://github.com/DynamoRIO/drmemory/issues/1819

Change-Id: I546d2057d39865d527c1d7c436f690669b214d75
üst 5319def8
...@@ -2346,7 +2346,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, ...@@ -2346,7 +2346,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf,
if( nKeyLen > 0 ) if( nKeyLen > 0 )
{ {
WCHAR *pW = aKeyBuf, *pE = aKeyBuf + nKeyLen; WCHAR *pW = aKeyBuf, *pE = aKeyBuf + nKeyLen;
while( *pW && (pW < pE) && (rCount < nMaxSize) ) while ((pW < pE) && *pW && (rCount < nMaxSize))
pBuf[rCount++] = *pW++; pBuf[rCount++] = *pW++;
} }
else // fall back to provided default name else // fall back to provided default name
......
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