From: Christian Heimes Date: Tue, 4 Feb 2014 23:29:17 +0000 (+0100) Subject: Issue #20515: Fix NULL pointer dereference introduced by issue #20368 X-Git-Tag: v3.4.0rc1~86^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d33491ea76b3898d5fd0fe3ae75e73ea157a7186;p=python Issue #20515: Fix NULL pointer dereference introduced by issue #20368 CID 1167595 --- diff --git a/Misc/NEWS b/Misc/NEWS index 045be47951..85321dd729 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -45,6 +45,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 #20426: When passing the re.DEBUG flag, re.compile() displays the diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index b106b4b901..262d679055 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -1568,6 +1568,9 @@ varname_converter(PyObject *in, void *_out) 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;