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


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

URL: http://github.com/miss-islington/cpython/commit/99704de2b4162207969d5bb4e3adf92b4ff5c9ea

s" /> gh-126108: Fix potential null pointer dereference in `PySys_AddWarnOp… · miss-islington/cpython@99704de · GitHub
Skip to content

Commit 99704de

Browse files
federicovalensomiss-islington
authored andcommitted
pythongh-126108: Fix potential null pointer dereference in PySys_AddWarnOptionUnicode (pythonGH-126118)
(cherry picked from commit fad36bf) Co-authored-by: Valery Fedorenko <federicovalenso@gmail.com>
1 parent 48f08fe commit 99704de

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
@@ -2653,6 +2653,7 @@ PySys_ResetWarnOptions(void)
26532653
static int
26542654
_PySys_AddWarnOptionWithError(PyThreadState *tstate, PyObject *option)
26552655
{
2656+
assert(tstate != NULL);
26562657
PyObject *warnoptions = get_warnoptions(tstate);
26572658
if (warnoptions == NULL) {
26582659
return -1;
@@ -2667,11 +2668,11 @@ void
26672668
PySys_AddWarnOptionUnicode(PyObject *option)
26682669
{
26692670
PyThreadState *tstate = _PyThreadState_GET();
2671+
_Py_EnsureTstateNotNULL(tstate);
2672+
assert(!_PyErr_Occurred(tstate));
26702673
if (_PySys_AddWarnOptionWithError(tstate, option) < 0) {
26712674
/* No return value, therefore clear error state if possible */
2672-
if (tstate) {
2673-
_PyErr_Clear(tstate);
2674-
}
2675+
_PyErr_Clear(tstate);
26752676
}
26762677
}
26772678

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