[Bugfix] sfVector2f_to_PyObject crashes on NULL from PyObject_GetAttrString #268
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#268
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
sfVector2f_to_PyObject()andsfVector2i_to_PyObject()callPyObject_GetAttrString()to look up theVectortype, then immediately dereference the result viatype->tp_alloc()without checking for NULL. If the module is in a bad state (e.g., during interpreter shutdown or if the module hasn't been fully initialized), this is a NULL pointer dereference → segfault.Root Cause
UIEntity.cpp:297-303:Same issue in
sfVector2i_to_PyObjectat line 306.Note:
typeis also neverPy_DECREF'd (see PyObject_GetAttrString leak issue).Reproduction
This is hard to trigger in normal operation since
McRFPy_API::mcrf_moduleis initialized early. But it can happen:mcrf_moduleis somehow NULLFix
Use the inline type declaration directly:
This eliminates both the NULL risk and the reference leak.
Severity
High — potential segfault. Low probability in normal operation but catastrophic when triggered.