Source-Python-Dev-Team / Source.Python

This plugin aims to use boost::python and create an easily accessible wrapper around the Source Engine API for scripter use.
http://forums.sourcepython.com
GNU General Public License v3.0
163 stars 31 forks source link

Pointer.set_pointer(None) causes Segmentation fault. #481

Open CookStar opened 1 year ago

CookStar commented 1 year ago

Isn't this supposed to be set to 0 (NULL)?

Code:

from memory import alloc

pointer = alloc(4, False)
pointer.set_pointer(None)

Output:

Thread 1 "srcds_linux" received signal SIGSEGV, Segmentation fault.
0xf0441c67 in CPointer::SetPtr(boost::python::api::object, int) ()
   from /home/steam/csgo_ds/csgo/addons/source-python/bin/core.so
=> 0xf0441c67 <_ZN8CPointer6SetPtrEN5boost6python3api6objectEi+71>:     8b 48 04        mov    ecx,DWORD PTR [eax+0x4]
jordanbriere commented 1 year ago

My first guess would be that pPtr is NULL there:

https://github.com/Source-Python-Dev-Team/Source.Python/blob/12a24f43db1e9ae86b233d244d12a6bba12cb351/src/core/modules/memory/memory_utilities.h#L81-L84