diff options
author | jenglish <jenglish@noemail.net> | 2004-06-16 20:03:17 (GMT) |
---|---|---|
committer | jenglish <jenglish@noemail.net> | 2004-06-16 20:03:17 (GMT) |
commit | 0207ae988fada9953cfa1294683434dacf4d94a3 (patch) | |
tree | d316493e03f85b97a1a55f3bf4a198db5c79bfbc /win | |
parent | 57b869e44651c4ca14eb2d8fcb3456764fdfcc48 (diff) | |
download | tk-0207ae988fada9953cfa1294683434dacf4d94a3.zip tk-0207ae988fada9953cfa1294683434dacf4d94a3.tar.gz tk-0207ae988fada9953cfa1294683434dacf4d94a3.tar.bz2 |
Fix for #742882 "Potential division by zero in gridded wm geometry"
FossilOrigin-Name: 4ca47059991de03c386b154f86b55de423cfb8d9
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinWm.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c index f2af06f..b7240a7 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.62 2004/06/12 05:38:45 a_kovalenko Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.63 2004/06/16 20:03:20 jenglish Exp $ */ #include "tkWinInt.h" @@ -3276,12 +3276,12 @@ WmGridCmd(tkwin, winPtr, interp, objc, objv) Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC); return TCL_ERROR; } - if (widthInc < 0) { - Tcl_SetResult(interp, "widthInc can't be < 0", TCL_STATIC); + if (widthInc <= 0) { + Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC); return TCL_ERROR; } - if (heightInc < 0) { - Tcl_SetResult(interp, "heightInc can't be < 0", TCL_STATIC); + if (heightInc <= 0) { + Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC); return TCL_ERROR; } Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc, @@ -4787,6 +4787,17 @@ Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc) register WmInfo *wmPtr; /* + * Ensure widthInc and heightInc are greater than 0 + */ + if (widthInc <= 0) { + widthInc = 1; + } + if (heightInc <= 0) { + heightInc = 1; + } + + + /* * Find the top-level window for tkwin, plus the window manager * information. */ |