summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-11-18 22:59:13 +0100
committerMichael Stahl <mstahl@redhat.com>2015-11-19 12:16:57 +0100
commitfdd958b8a3f3bda0b39959cb4ac3184ae232e279 (patch)
treed0b488de2208eb21264576869ab03587d29d60cd
parent5319def848e855068512f0f895086ff7a1f9e44f (diff)
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
-rw-r--r--vcl/win/source/window/salframe.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 697efae532e4..4b873a96ec74 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2346,7 +2346,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf,
if( nKeyLen > 0 )
{
WCHAR *pW = aKeyBuf, *pE = aKeyBuf + nKeyLen;
- while( *pW && (pW < pE) && (rCount < nMaxSize) )
+ while ((pW < pE) && *pW && (rCount < nMaxSize))
pBuf[rCount++] = *pW++;
}
else // fall back to provided default name