-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-126108: Fix potential null pointer dereference in PySys_AddWarnOptionUnicode #126118
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
Changes from all commits
e355186
2ca65fe
0fb17bc
6c22e44
6cd01fd
a969026
1667599
9323183
5cd8e30
f234711
67b9de2
7d0754f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix a possible ``NULL`` pointer dereference in :c:func:`!PySys_AddWarnOptionUnicode`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2846,6 +2846,7 @@ PySys_ResetWarnOptions(void) | |
static int | ||
_PySys_AddWarnOptionWithError(PyThreadState *tstate, PyObject *option) | ||
{ | ||
assert(tstate != NULL); | ||
PyObject *warnoptions = get_warnoptions(tstate); | ||
if (warnoptions == NULL) { | ||
return -1; | ||
|
@@ -2861,11 +2862,11 @@ PyAPI_FUNC(void) | |
PySys_AddWarnOptionUnicode(PyObject *option) | ||
{ | ||
PyThreadState *tstate = _PyThreadState_GET(); | ||
_Py_EnsureTstateNotNULL(tstate); | ||
kumaraditya303 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assert(!_PyErr_Occurred(tstate)); | ||
if (_PySys_AddWarnOptionWithError(tstate, option) < 0) { | ||
/* No return value, therefore clear error state if possible */ | ||
if (tstate) { | ||
picnixz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_PyErr_Clear(tstate); | ||
} | ||
_PyErr_Clear(tstate); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that there's no way to make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it actually make sense to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, in that case, I would like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I do some other changes or leave as is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also do it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.