summaryrefslogtreecommitdiff
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-11 10:58:02 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-11 10:58:02 +0300
commitd5fd6188e286a52334e24ef1ce4467618c2c1271 (patch)
tree525e720f81bcf93c6c8116f03b22ea585e913a08 /Modules/_tkinter.c
parent979f80b8da091c596f5e602accfb91962a816056 (diff)
parentabf68ce16474a2d252723099f1c7a6d640191123 (diff)
downloadcpython-git-d5fd6188e286a52334e24ef1ce4467618c2c1271.tar.gz
Issue #21951: Fixed a crash in Tkinter on AIX when called Tcl command with
empty string or tuple argument. On some platforms Tcl memory allocator returns NULL when allocating zero-sized block of memory.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index a8e6d9828c..02fcb818a3 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -906,6 +906,8 @@ AsObj(PyObject *value)
Py_ssize_t size, i;
size = PySequence_Fast_GET_SIZE(value);
+ if (size == 0)
+ return Tcl_NewListObj(0, NULL);
if (!CHECK_SIZE(size, sizeof(Tcl_Obj *))) {
PyErr_SetString(PyExc_OverflowError,
PyTuple_Check(value) ? "tuple is too long" :
@@ -936,6 +938,8 @@ AsObj(PyObject *value)
inbuf = PyUnicode_DATA(value);
size = PyUnicode_GET_LENGTH(value);
+ if (size == 0)
+ return Tcl_NewUnicodeObj((const void *)"", 0);
if (!CHECK_SIZE(size, sizeof(Tcl_UniChar))) {
PyErr_SetString(PyExc_OverflowError, "string is too long");
return NULL;