summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--macosx/tkMacOSXWm.c23
-rw-r--r--tests/unixWm.test6
-rw-r--r--tests/wm.test6
-rw-r--r--unix/tkUnixWm.c20
-rw-r--r--win/tkWinWm.c21
6 files changed, 60 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index e391276..e828336 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-06-16 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c, win/tkWinWm.c, macosx/tkMacOSXWm.c,
+ tests/wm.test, tests/unixWm.test: Fix for #742882
+ "Potential division by zero in gridded wm geometry"
+
2004-06-15 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
* win/tkWinButton.c: Add a 3D highlight to disabled *buttons and
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 61ddb1d..0ea8b18 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.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: tkMacOSXWm.c,v 1.11 2004/02/16 00:19:42 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.12 2004/06/16 20:03:18 jenglish Exp $
*/
#include <Carbon/Carbon.h>
@@ -1318,12 +1318,12 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
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,
@@ -2658,6 +2658,17 @@ Tk_SetGrid(
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.
*/
@@ -2710,7 +2721,7 @@ Tk_SetGrid(
wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
- Tk_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
}
}
diff --git a/tests/unixWm.test b/tests/unixWm.test
index aa6da1c..9d9e02e 100644
--- a/tests/unixWm.test
+++ b/tests/unixWm.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: unixWm.test,v 1.36 2003/11/18 01:47:51 dgp Exp $
+# RCS: @(#) $Id: unixWm.test,v 1.37 2004/06/16 20:03:19 jenglish Exp $
package require tcltest 2.2
eval tcltest::configure $argv
@@ -728,13 +728,13 @@ test unixWm-20.8 {Tk_WmCmd procedure, "grid" option} unix {
} {1 {expected integer but got "bar"}}
test unixWm-20.9 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 -2 13} msg] $msg
-} {1 {widthInc can't be < 0}}
+} {1 {widthInc can't be <= 0}}
test unixWm-20.10 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 12 bogus} msg] $msg
} {1 {expected integer but got "bogus"}}
test unixWm-20.11 {Tk_WmCmd procedure, "grid" option} unix {
list [catch {wm grid .t 10 11 12 -1} msg] $msg
-} {1 {heightInc can't be < 0}}
+} {1 {heightInc can't be <= 0}}
catch {destroy .t}
catch {destroy .icon}
diff --git a/tests/wm.test b/tests/wm.test
index 24a8ee2..e8f2c48 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: wm.test,v 1.25 2004/05/23 17:34:50 dkf Exp $
+# RCS: @(#) $Id: wm.test,v 1.26 2004/06/16 20:03:19 jenglish Exp $
# This file tests window manager interactions that work across
# platforms. Window manager tests that only work on a specific
@@ -393,11 +393,11 @@ test wm-grid-1.10 {usage} {
test wm-grid-1.11 {usage} {
list [catch {wm grid . 13 14 -1 16} msg] $msg
-} {1 {widthInc can't be < 0}}
+} {1 {widthInc can't be <= 0}}
test wm-grid-1.12 {usage} {
list [catch {wm grid . 13 14 15 -1} msg] $msg
-} {1 {heightInc can't be < 0}}
+} {1 {heightInc can't be <= 0}}
test wm-grid-2.1 {setting and reading values} {
set result {}
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.
*/
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.
*/