summaryrefslogtreecommitdiffstats
path: root/PC/pyshellext.cpp
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2018-09-25 04:25:23 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-25 04:25:23 (GMT)
commitf6c8007a29b95b3ea3ca687a9b4924769a696328 (patch)
tree87076a61d0e9ca2d1a639e95aa7486586b3a8da9 /PC/pyshellext.cpp
parentb60b4683f6c995e9205f68439023c80a0b628f39 (diff)
downloadcpython-f6c8007a29b95b3ea3ca687a9b4924769a696328.zip
cpython-f6c8007a29b95b3ea3ca687a9b4924769a696328.tar.gz
cpython-f6c8007a29b95b3ea3ca687a9b4924769a696328.tar.bz2
bpo-34770: Fix a possible null pointer dereference in pyshellext.cpp (GH-9497)
The GlobalLock() call in UpdateDropDescription() was not checked for failure. https://bugs.python.org/issue34770
Diffstat (limited to 'PC/pyshellext.cpp')
-rw-r--r--PC/pyshellext.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/PC/pyshellext.cpp b/PC/pyshellext.cpp
index 04fe61e..0198802 100644
--- a/PC/pyshellext.cpp
+++ b/PC/pyshellext.cpp
@@ -172,6 +172,11 @@ private:
return E_FAIL;
}
auto dd = (DROPDESCRIPTION*)GlobalLock(medium.hGlobal);
+ if (!dd) {
+ OutputDebugString(L"PyShellExt::UpdateDropDescription - failed to lock DROPDESCRIPTION hGlobal");
+ ReleaseStgMedium(&medium);
+ return E_FAIL;
+ }
StringCchCopy(dd->szMessage, sizeof(dd->szMessage) / sizeof(dd->szMessage[0]), DRAG_MESSAGE);
StringCchCopy(dd->szInsert, sizeof(dd->szInsert) / sizeof(dd->szInsert[0]), PathFindFileNameW(target));
dd->type = DROPIMAGE_MOVE;