Skip to content

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

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
CookStar opened this issue Jun 28, 2023 · 2 comments
Closed

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

CookStar opened this issue Jun 28, 2023 · 2 comments
Labels

Comments

@CookStar
Copy link
Contributor

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
Copy link
Contributor

My first guess would be that pPtr is NULL there:

if (bValidate)
pPtr->Validate();
return pPtr->m_ulAddr;

@Ayuto
Copy link
Member

Ayuto commented Apr 18, 2025

Definitely a bug, but Jordan is right regarding the design. It's probably better to explicitly use NULL if you want to use a NULL pointer. Though, it's also quite convenient to use None.

@Ayuto Ayuto closed this as completed Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants