diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-25 09:06:58 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-25 09:06:58 (GMT) |
commit | 6e45c77b9e39f3821b86a7d767a179e1f8275984 (patch) | |
tree | a954daab606c8455e8c20c342a0f9366c725602b | |
parent | 5a47ee4e3f63fa9f40d1b964b9c1eb1ab7e9480d (diff) | |
download | tk-6e45c77b9e39f3821b86a7d767a179e1f8275984.zip tk-6e45c77b9e39f3821b86a7d767a179e1f8275984.tar.gz tk-6e45c77b9e39f3821b86a7d767a179e1f8275984.tar.bz2 |
Prevent zero-size malloc() calls. [Bug 2178820]
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.c | 6 |
2 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,9 @@ 2009-03-25 Donal K. Fellows <dkf@users.sf.net> + * generic/ttk/ttkTheme.c (BuildOptionMap, NewElementClass): + [Bug 2178820]: Ensure that zero-size allocations don't happen; some + malloc implementations don't like it at all. + * win/wish.exe.manifest.in: [Bug 1871101]: Add magic to make Tk not be blurred on Vista with large fonts. diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 9787b4b..e19ca20 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * $Id: ttkTheme.c,v 1.18 2009/02/08 19:35:35 jenglish Exp $ + * $Id: ttkTheme.c,v 1.19 2009/03/25 09:06:58 dkf Exp $ */ #include <stdlib.h> @@ -182,7 +182,7 @@ static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { OptionMap optionMap = (OptionMap)ckalloc( - sizeof(const Tk_OptionSpec) * elementClass->nResources); + sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; for (i = 0; i < elementClass->nResources; ++i) { @@ -241,7 +241,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ elementClass->defaultValues = (Tcl_Obj**) - ckalloc(elementClass->nResources * sizeof(Tcl_Obj *)); + ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; if (defaultValue) { |