Tk Source Code

View Ticket
Login
Ticket UUID: 742882
Title: Potential division by zero in gridded wm geometry
Type: Bug Version: None
Submitter: jenglish Created on: 2003-05-24 21:15:07
Subsystem: 67. Unix Window Operations Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-06-17 15:00:37
Resolution: Fixed Closed By: jenglish
    Closed on: 2004-06-16 19:59:49
Description:
% wm grid . 100 100 0 0
% Floating point exception (core dumped)

Stack backtrace:

Program received signal SIGFPE, Arithmetic exception.
0x0806d396 in GetMaxSize (wmPtr=0x81cfec0,
maxWidthPtr=0xbffff634,
    maxHeightPtr=0xbffff630) at
/usr/local/src/tk/unix/tkUnixWm.c:5839
5839                tmp = wmPtr->reqGridWidth
(gdb) where
#0  0x0806d396 in GetMaxSize (wmPtr=0x81cfec0,
maxWidthPtr=0xbffff634,
    maxHeightPtr=0xbffff630) at
/usr/local/src/tk/unix/tkUnixWm.c:5839
#1  0x0806b7d8 in UpdateSizeHints (winPtr=0x81cfdd0,
newWidth=200,
    newHeight=200) at
/usr/local/src/tk/unix/tkUnixWm.c:4235
#2  0x0806b4db in UpdateGeometryInfo (clientData=0x81cfdd0)
    at /usr/local/src/tk/unix/tkUnixWm.c:4079
#3  0x08164257 in TclServiceIdle ()
#4  0x08153e02 in Tcl_DoOneEvent ()


Bug present in CVS HEAD, 8.4, 8.3, and probably earlier.
User Comments: jenglish added on 2004-06-17 02:59:49:
Logged In: YES 
user_id=68433

Patch committed; closing.

jenglish added on 2004-06-17 02:51:09:

File Added - 90891: tk-wm-grid-div0.patch

Logged In: YES 
user_id=68433

Attached patch changes [wm grid] to signal an error if
widthInc or heightInc are less than or equal to zero
(previously only checked if they were less than zero), and
changes Tk_SetGrid to silently ensure that widthInc and
heightInc are strictly positive in case a widget passes bad
data to Tk_SetGrid.

Identical changes made in win/tkWinWm.c and macosx/tkMacOSXWm.c.

wm.test and unixWm.test pass (WM: sawfish, on Debian testing).

Attachments: