Commit 50286358 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed possible integer overflow in getint, getdouble and getboolean too (issue #21552).

parent d3e62b62
...@@ -1894,6 +1894,7 @@ Tkapp_GetInt(PyObject *self, PyObject *args) ...@@ -1894,6 +1894,7 @@ Tkapp_GetInt(PyObject *self, PyObject *args)
} }
if (!PyArg_ParseTuple(args, "s:getint", &s)) if (!PyArg_ParseTuple(args, "s:getint", &s))
return NULL; return NULL;
CHECK_STRING_LENGTH(s);
if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR) if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self); return Tkinter_Error(self);
return Py_BuildValue("i", v); return Py_BuildValue("i", v);
...@@ -1914,6 +1915,7 @@ Tkapp_GetDouble(PyObject *self, PyObject *args) ...@@ -1914,6 +1915,7 @@ Tkapp_GetDouble(PyObject *self, PyObject *args)
} }
if (!PyArg_ParseTuple(args, "s:getdouble", &s)) if (!PyArg_ParseTuple(args, "s:getdouble", &s))
return NULL; return NULL;
CHECK_STRING_LENGTH(s);
if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR) if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self); return Tkinter_Error(self);
return Py_BuildValue("d", v); return Py_BuildValue("d", v);
...@@ -1934,6 +1936,7 @@ Tkapp_GetBoolean(PyObject *self, PyObject *args) ...@@ -1934,6 +1936,7 @@ Tkapp_GetBoolean(PyObject *self, PyObject *args)
} }
if (!PyArg_ParseTuple(args, "s:getboolean", &s)) if (!PyArg_ParseTuple(args, "s:getboolean", &s))
return NULL; return NULL;
CHECK_STRING_LENGTH(s);
if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR) if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR)
return Tkinter_Error(self); return Tkinter_Error(self);
return PyBool_FromLong(v); return PyBool_FromLong(v);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment