[Python-checkins] cpython (merge 3.3 -> default): Issue #20515: Fix NULL pointer dereference introduced by issue #20368

christian.heimes python-checkins at python.org
Wed Feb 5 00:31:45 CET 2014


http://hg.python.org/cpython/rev/145032f626d3
changeset:   88966:145032f626d3
parent:      88964:92fc6850dea0
parent:      88965:d83ce3a2d954
user:        Christian Heimes <christian at python.org>
date:        Wed Feb 05 00:29:48 2014 +0100
summary:
  Issue #20515: Fix NULL pointer dereference introduced by issue #20368
CID 1167595

files:
  Misc/NEWS          |  2 ++
  Modules/_tkinter.c |  3 +++
  2 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,8 @@
 Library
 -------
 
+- Issue #20515: Fix NULL pointer dereference introduced by issue #20368.
+
 - Issue #19186: Restore namespacing of expat symbols inside the pyexpat module.
 
 - Issue #20053: ensurepip (and hence venv) are no longer affected by the
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -1397,6 +1397,9 @@
     if (PyUnicode_Check(in)) {
         Py_ssize_t size;
         s = PyUnicode_AsUTF8AndSize(in, &size);
+        if (s == NULL) {
+            return 0;
+        }
         if (size > INT_MAX) {
             PyErr_SetString(PyExc_OverflowError, "string is too long");
             return 0;

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


More information about the Python-checkins mailing list