[Python-checkins] r59685 - in python/branches/release25-maint: Misc/NEWS Modules/_tkinter.c
guido.van.rossum
python-checkins at python.org
Fri Jan 4 00:52:05 CET 2008
Author: guido.van.rossum
Date: Fri Jan 4 00:52:04 2008
New Revision: 59685
Modified:
python/branches/release25-maint/Misc/NEWS
python/branches/release25-maint/Modules/_tkinter.c
Log:
Fix bug #1301 -- a bad assert in _tkinter.
Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS (original)
+++ python/branches/release25-maint/Misc/NEWS Fri Jan 4 00:52:04 2008
@@ -157,6 +157,8 @@
Extension Modules
-----------------
+- Bug #1301: Bad assert in _tkinter fixed.
+
- Bug #1649098: Avoid declaration of zero-sized array declaration in
structure.
Modified: python/branches/release25-maint/Modules/_tkinter.c
==============================================================================
--- python/branches/release25-maint/Modules/_tkinter.c (original)
+++ python/branches/release25-maint/Modules/_tkinter.c Fri Jan 4 00:52:04 2008
@@ -936,10 +936,12 @@
/* This #ifdef assumes that Tcl uses UCS-2.
See TCL_UTF_MAX test above. */
#if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
- Tcl_UniChar *outbuf;
+ Tcl_UniChar *outbuf = NULL;
Py_ssize_t i;
- assert(size < size * sizeof(Tcl_UniChar));
- outbuf = (Tcl_UniChar*)ckalloc(size * sizeof(Tcl_UniChar));
+ size_t allocsize = ((size_t)size) * sizeof(Tcl_UniChar);
+ if (allocsize >= size)
+ outbuf = (Tcl_UniChar*)ckalloc(allocsize);
+ /* Else overflow occurred, and we take the next exit */
if (!outbuf) {
PyErr_NoMemory();
return NULL;
More information about the Python-checkins
mailing list