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
Show file tree
Hide file tree
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
Next Next commit
Fixed ExtractAddress causing Segmentation fault if it received None o…
…bject.
  • Loading branch information
CookStar committed Jun 29, 2023
commit 34eba9c6fe33b53dd6ce6566cc2608799c2f1c5c
2 changes: 1 addition & 1 deletion src/core/modules/filters/filters_recipients.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class MRecipientFilter : public IRecipientFilter
object self = cls();
object add_recipient = self.attr("add_recipient");

IRecipientFilter *pFilter = (IRecipientFilter *)ExtractAddress(oPtr);
IRecipientFilter *pFilter = (IRecipientFilter *)ExtractAddress(oPtr, true);
for (int i=0; i < pFilter->GetRecipientCount(); i++) {
add_recipient(pFilter->GetRecipientIndex(i));
}
Expand Down
3 changes: 3 additions & 0 deletions src/core/modules/memory/memory_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
// ============================================================================
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 Down