You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Null dereferencing of a pointer in initconfig.c #160962
Potentially, if "value" equals NULL and "spec->type" equals "PyConfig_MEMBER_WSTR_OPT", null will be passed into "utf8_to_wstr" function and might cause a segmentation fault in strlen
Activity
[-]Null derefication of a pointer in initconfig.c[/-][+]Null dereferencing of a pointer in initconfig.c[/+]lazerg commentedon Oct 30, 2026
I will work on it if maintainers approve
picnixz commentedon Oct 30, 2026
Hoe can a NUL-terminated UTF8 string be NULL? are other functions checking for nullity? i believe this is unnecessary churn.
Aruise commentedon Oct 30, 2026
@picnixz
It does describe "value" as a null-terminated UTF-8 string, yes, which indeed does not explicitly allow NULL
However, the implementation explicitly checks whether "value" is NULL, suggesting that NULL might have been intended to be supported at some point
NekoAsakura commentedon Oct 30, 2026
Reproduced on
main:Original implementation (#123502) added the NULL check with an explicit exemption for
PyConfig_MEMBER_WSTR_OPT, but had noreturn -1:cpython/Python/initconfig.c
Lines 3809 to 3815 in ef9d547
It was partially fixed in #159769 (comment), but left the
WSTR_OPTexemption as-is.cc @vstinner