changeset 88966:145032f626d3

Issue #20515: Fix NULL pointer dereference introduced by issue #20368 CID 1167595 [#20515]
author Christian Heimes <christian@python.org>
date Wed, 05 Feb 2014 00:29:48 +0100
parents 92fc6850dea0 (current diff) d83ce3a2d954 (diff)
children 32af4954e46a
files Misc/NEWS Modules/_tkinter.c
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,8 @@ Core and Builtins
 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
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -1397,6 +1397,9 @@ varname_converter(PyObject *in, void *_o
     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;