[Python-checkins] cpython (3.5): make the PyUnicode_FSConverter cleanup set the decrefed argument to NULL

benjamin.peterson python-checkins at python.org
Mon Nov 16 00:58:16 EST 2015


https://hg.python.org/cpython/rev/3ae62099d70b
changeset:   99151:3ae62099d70b
branch:      3.5
parent:      99149:55f7a99a5433
user:        Benjamin Peterson <benjamin at python.org>
date:        Sun Nov 15 21:57:39 2015 -0800
summary:
  make the PyUnicode_FSConverter cleanup set the decrefed argument to NULL (closes #25630)

files:
  Misc/NEWS               |  3 +++
  Objects/unicodeobject.c |  1 +
  2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -11,6 +11,9 @@
 Core and Builtins
 -----------------
 
+- Issue #25630: Fix a possible segfault during argument parsing in functions
+  that accept filesystem paths.
+
 - Issue #23564: Fixed a partially broken sanity check in the _posixsubprocess
   internals regarding how fds_to_pass were passed to the child.  The bug had
   no actual impact as subprocess.py already avoided it.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3614,6 +3614,7 @@
     void *data;
     if (arg == NULL) {
         Py_DECREF(*(PyObject**)addr);
+        *(PyObject**)addr = NULL;
         return 1;
     }
     if (PyBytes_Check(arg)) {

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list