summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-11 07:57:13 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-11 07:57:13 (GMT)
commitabf68ce16474a2d252723099f1c7a6d640191123 (patch)
tree1300b07bd551a888966a4d2d77636dc68a540351 /Modules/_tkinter.c
parent07940883796e71135723616f06a1405105c09571 (diff)
downloadcpython-abf68ce16474a2d252723099f1c7a6d640191123.zip
cpython-abf68ce16474a2d252723099f1c7a6d640191123.tar.gz
cpython-abf68ce16474a2d252723099f1c7a6d640191123.tar.bz2
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 7871dec..6d777d3 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -899,6 +899,8 @@ AsObj(PyObject *value)
Py_ssize_t size, i;
size = PyTuple_Size(value);
+ if (size == 0)
+ return Tcl_NewListObj(0, NULL);
if (!CHECK_SIZE(size, sizeof(Tcl_Obj *))) {
PyErr_SetString(PyExc_OverflowError, "tuple is too long");
return NULL;
@@ -925,6 +927,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;