Skip to content

Fixed ExtractAddress causing Segmentation fault if it received None object. (#481) #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fixed the crash when _ptr() returns None.
  • Loading branch information
CookStar committed Jun 29, 2023
commit e4b0a8017b1a1183fd5ee74b6f9da6ead82c6c86
6 changes: 3 additions & 3 deletions src/core/modules/memory/memory_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@
// ============================================================================
inline unsigned long ExtractAddress(object oPtr, bool bValidate = false)
{
if (oPtr.is_none())
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "None was passed, expected Pointer(0) or NULL.")

CPointer* pPtr;

extract<CPointer *> extractor(oPtr);
Expand All @@ -81,6 +78,9 @@ inline unsigned long ExtractAddress(object oPtr, bool bValidate = false)
pPtr = extractor();
}

if (!pPtr)
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "None was passed, expected NULL or Pointer(0).")

if (bValidate)
pPtr->Validate();

Expand Down