pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/srinivasreddy/cpython/commit/584c90ba45a0efd234afcc470fce9e5fc12fce3e

ss" /> gh-126108: Fix potential null pointer dereference in `PySys_AddWarnOp… · srinivasreddy/cpython@584c90b · GitHub
Skip to content

Commit 584c90b

Browse files
federicovalensosrinivasreddy
authored andcommitted
pythongh-126108: Fix potential null pointer dereference in PySys_AddWarnOptionUnicode (python#126118)
1 parent aaa2f94 commit 584c90b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a possible ``NULL`` pointer dereference in :c:func:`!PySys_AddWarnOptionUnicode`.

Python/sysmodule.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,6 +2854,7 @@ PySys_ResetWarnOptions(void)
28542854
static int
28552855
_PySys_AddWarnOptionWithError(PyThreadState *tstate, PyObject *option)
28562856
{
2857+
assert(tstate != NULL);
28572858
PyObject *warnoptions = get_warnoptions(tstate);
28582859
if (warnoptions == NULL) {
28592860
return -1;
@@ -2869,11 +2870,11 @@ PyAPI_FUNC(void)
28692870
PySys_AddWarnOptionUnicode(PyObject *option)
28702871
{
28712872
PyThreadState *tstate = _PyThreadState_GET();
2873+
_Py_EnsureTstateNotNULL(tstate);
2874+
assert(!_PyErr_Occurred(tstate));
28722875
if (_PySys_AddWarnOptionWithError(tstate, option) < 0) {
28732876
/* No return value, therefore clear error state if possible */
2874-
if (tstate) {
2875-
_PyErr_Clear(tstate);
2876-
}
2877+
_PyErr_Clear(tstate);
28772878
}
28782879
}
28792880

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy