diff options
author | jenglish@flightlab.com <jenglish> | 2004-06-16 20:03:18 (GMT) |
---|---|---|
committer | jenglish@flightlab.com <jenglish> | 2004-06-16 20:03:18 (GMT) |
commit | 44695e4e926e434566247302ac6939d0dded0951 (patch) | |
tree | d316493e03f85b97a1a55f3bf4a198db5c79bfbc /unix/tkUnixWm.c | |
parent | 8955195ccec75b78f32566e7301bfdea6a92b811 (diff) | |
download | tk-44695e4e926e434566247302ac6939d0dded0951.zip tk-44695e4e926e434566247302ac6939d0dded0951.tar.gz tk-44695e4e926e434566247302ac6939d0dded0951.tar.bz2 |
Fix for #742882 "Potential division by zero in gridded wm geometry"
Diffstat (limited to 'unix/tkUnixWm.c')
-rw-r--r-- | unix/tkUnixWm.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 94162bd..c9f2760 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.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: tkUnixWm.c,v 1.41 2004/04/04 20:08:39 jenglish Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.42 2004/06/16 20:03:19 jenglish Exp $ */ #include "tkPort.h" @@ -1729,12 +1729,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, @@ -3225,6 +3225,16 @@ 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. */ |