From 6e45c77b9e39f3821b86a7d767a179e1f8275984 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 25 Mar 2009 09:06:58 +0000 Subject: Prevent zero-size malloc() calls. [Bug 2178820] --- ChangeLog | 4 ++++ generic/ttk/ttkTheme.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7b27d0..0b895dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-03-25 Donal K. Fellows + * 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 @@ -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) { -- cgit v0.12