diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-25 09:10:04 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-03-25 09:10:04 (GMT) |
commit | 2bc412bce298c5df68991269aa88483ad158e108 (patch) | |
tree | c8b1abc8caf5d76271c8345b11be06abafa62927 | |
parent | b538cddb15fe7c5adca98283566bdd359126e08a (diff) | |
download | tk-2bc412bce298c5df68991269aa88483ad158e108.zip tk-2bc412bce298c5df68991269aa88483ad158e108.tar.gz tk-2bc412bce298c5df68991269aa88483ad158e108.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, NewElementImpl): + [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 598bc34..04dab19 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.11 2007/12/13 15:26:26 dgp Exp $ + * $Id: ttkTheme.c,v 1.11.2.1 2009/03/25 09:10:04 dkf Exp $ */ #include <stdlib.h> @@ -186,7 +186,7 @@ static OptionMap BuildOptionMap(ElementImpl *elementImpl, Tk_OptionTable optionTable) { OptionMap optionMap = (OptionMap)ckalloc( - sizeof(const Tk_OptionSpec) * elementImpl->nResources); + sizeof(const Tk_OptionSpec) * elementImpl->nResources + 1); int i; for (i = 0; i < elementImpl->nResources; ++i) { @@ -244,7 +244,7 @@ NewElementImpl(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ elementImpl->defaultValues = (Tcl_Obj**) - ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *)); + ckalloc(elementImpl->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementImpl->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; if (defaultValue) { |