summaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-24 21:44:11 -0700
committerGitHub <noreply@github.com>2018-09-24 21:44:11 -0700
commitdb23206367e2bfbbdfb29b7699f25a14ba353ae7 (patch)
treeda168924eb6b5baae0a5cf2abd2153405f5f15a1 /PC
parentbbdf8723324e31675f298dd273733cc13e1518df (diff)
downloadcpython-git-db23206367e2bfbbdfb29b7699f25a14ba353ae7.tar.gz
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 (cherry picked from commit f6c8007a29b95b3ea3ca687a9b4924769a696328) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'PC')
-rw-r--r--PC/pyshellext.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/PC/pyshellext.cpp b/PC/pyshellext.cpp
index 04fe61e896..019880264b 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;