Skip to content

Commit

Permalink
bpo-34770: Fix a possible null pointer dereference in pyshellext.cpp (G…
Browse files Browse the repository at this point in the history
…H-9497)

The GlobalLock() call in UpdateDropDescription() was not checked for
failure.

https://bugs.python.org/issue34770
(cherry picked from commit f6c8007)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
  • Loading branch information
miss-islington and ZackerySpytz committed Sep 25, 2018
1 parent bbdf872 commit db23206
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
@@ -0,0 +1 @@
Fix a possible null pointer dereference in pyshellext.cpp.
5 changes: 5 additions & 0 deletions PC/pyshellext.cpp
Expand Up @@ -172,6 +172,11 @@ class PyShellExt : public RuntimeClass<
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;
Expand Down

0 comments on commit db23206

Please sign in to comment.