Tk Library Source Code

View Ticket
Login
Ticket UUID: 1145523
Title: bwidget - progressbar divide by zero
Type: Bug Version: None
Submitter: bschofield Created on: 2005-02-21 15:37:14
Subsystem: bwidget Assigned To: damonc
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2006-02-11 06:06:13
Resolution: None Closed By: dev_null42a
    Closed on: 2006-02-10 23:06:13
Description:
BWidget version 1.7
progressbar.tcl line ~152 in proc ProgressBar::_modify

Where the "max" is determined from the widget's option
"-maximum". It is possible if the user configured the
-maximum to be 0, that you will get a divide by zero error.

While this shouldn't happen often, it is reasonable to
assume that the user might try to set this value to 0.
The progress bar should either throw an error
immediately when the user configures the widget to have
-maximum that is unacceptable or the progress bar
should handle the value.

adding

  if {$max == 0} { set max 1}

just after [Widget::getoption $path -maximum] call
fixes this the divide by 0 error.
User Comments: dev_null42a added on 2006-02-11 06:06:13:
Logged In: YES 
user_id=1381097

ProgressBar now makes explicit check, disallowing having a
-maximum 0.