diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-05-19 00:55:02 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-05-19 00:55:02 -0700 |
commit | 482fa683055ced70832b7c05ec7525add04ba4f5 (patch) | |
tree | eedeeba368affbe3ae0b82542b3d4cdc2d931d23 /src/zap/zapimage.cpp | |
parent | dcbc809202ff9017afbed25d1f7ae9348701639c (diff) | |
download | coreclr-482fa683055ced70832b7c05ec7525add04ba4f5.tar.gz coreclr-482fa683055ced70832b7c05ec7525add04ba4f5.tar.bz2 coreclr-482fa683055ced70832b7c05ec7525add04ba4f5.zip |
Fix potential null pointer dereference
Calling WriteFile with both lpOverlapped and lpNumberOfBytesWritten set to null is invalid combination on Windows 7
[tfs-changeset: 1472978]
Diffstat (limited to 'src/zap/zapimage.cpp')
-rw-r--r-- | src/zap/zapimage.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index a7723c74d0..09e2b4dd9d 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -914,6 +914,10 @@ public: m_hasher.HashMore(pv, cb); + // We are calling with lpOverlapped == NULL so pcbWritten has to be present + // to prevent crashes in Win7 and below. + _ASSERTE(pcbWritten); + if (!::WriteFile(m_hFile, pv, cb, pcbWritten, NULL)) { hr = HRESULT_FROM_GetLastError(); |