summaryrefslogtreecommitdiff
path: root/src/zap/zapimage.cpp
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-05-19 00:55:02 -0700
committerJan Kotas <jkotas@microsoft.com>2015-05-19 00:55:02 -0700
commit482fa683055ced70832b7c05ec7525add04ba4f5 (patch)
treeeedeeba368affbe3ae0b82542b3d4cdc2d931d23 /src/zap/zapimage.cpp
parentdcbc809202ff9017afbed25d1f7ae9348701639c (diff)
downloadcoreclr-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.cpp4
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();