Skip to content

Commit dcc106b

Browse files
committed
Added pointer validation to memory.make_object()
1 parent 141755f commit dcc106b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/core/modules/memory/memory_tools.h

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ inline object MakeObject(object cls, CPointer* pPtr)
5454
if (!PyObject_HasAttrString(cls.ptr(), GET_OBJ_NAME))
5555
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Unable to make an object using this class.");
5656

57+
if (!pPtr->IsValid())
58+
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Pointer is NULL.");
59+
5760
return cls.attr(GET_OBJ_NAME)(ptr(pPtr));
5861
}
5962

0 commit comments

Comments
 (0)