Code:
frommemoryimportPointerfrommemoryimportallocdeftest_pointer():
ptr=alloc(4)
Pointer(ptr)
test_pointer()
Output:
free(): double free detected in tcache 2
This also applies to CustomType.
Code:
frommemoryimportallocfrommemoryimportmake_objectfrommemory.managerimportCustomTypefrommemory.managerimportTypeManagermanager=TypeManager()
classTest(CustomType, metaclass=manager):
_size=4deftest_customtype():
ptr=alloc(4)
make_object(Test, ptr)
test_customtype()
Output:
free(): double free detected in tcache 2
Code:
Output:
This also applies to
CustomType.Code:
Output: