[Python-checkins] cpython (merge 3.3 -> default): Issue #18559: Fix NULL pointer dereference error in _pickle module

christian.heimes python-checkins at python.org
Fri Jul 26 22:45:59 CEST 2013


http://hg.python.org/cpython/rev/b33f81974516
changeset:   84845:b33f81974516
parent:      84843:f7a0a4e0ada4
parent:      84844:dbdd07657e23
user:        Christian Heimes <christian at cheimes.de>
date:        Fri Jul 26 22:45:47 2013 +0200
summary:
  Issue #18559: Fix NULL pointer dereference error in _pickle module

files:
  Misc/NEWS         |   2 ++
  Modules/_pickle.c |  10 ++++++----
  2 files changed, 8 insertions(+), 4 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -166,6 +166,8 @@
 Library
 -------
 
+- Issue #18559: Fix NULL pointer dereference error in _pickle module
+
 - Issue #18556: Check the return type of PyUnicode_AsWideChar() in ctype's
   U_set().
 
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -4836,9 +4836,10 @@
     value = _Unpickler_MemoGet(self, idx);
     if (value == NULL) {
         PyObject *key = PyLong_FromSsize_t(idx);
-        if (!PyErr_Occurred())
+        if (key != NULL) {
             PyErr_SetObject(PyExc_KeyError, key);
-        Py_DECREF(key);
+            Py_DECREF(key);
+        }
         return -1;
     }
 
@@ -4861,9 +4862,10 @@
     value = _Unpickler_MemoGet(self, idx);
     if (value == NULL) {
         PyObject *key = PyLong_FromSsize_t(idx);
-        if (!PyErr_Occurred())
+        if (key != NULL) {
             PyErr_SetObject(PyExc_KeyError, key);
-        Py_DECREF(key);
+            Py_DECREF(key);
+        }
         return -1;
     }
 

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


More information about the Python-checkins mailing list