diff options
author | fvogel <fvogelnew1@free.fr> | 2014-10-29 23:05:22 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2014-10-29 23:05:22 (GMT) |
commit | f3920ba043d2210ee77a82e052b6861a04815dea (patch) | |
tree | 433fa3e460cb7047d9e0ff397038377489942e09 | |
parent | 90f1bb2871f27fb60b636b4b70b9b6e5f9dc3eda (diff) | |
download | tk-f3920ba043d2210ee77a82e052b6861a04815dea.zip tk-f3920ba043d2210ee77a82e052b6861a04815dea.tar.gz tk-f3920ba043d2210ee77a82e052b6861a04815dea.tar.bz2 |
Fixed bug [3417012fff]
-rw-r--r-- | generic/tkScale.c | 11 | ||||
-rw-r--r-- | tests/scale.test | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c index 28e5b16..258a1fa 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -632,7 +632,12 @@ ConfigureScale( scalePtr->tickInterval = -scalePtr->tickInterval; } - ComputeFormat(scalePtr); + if (scalePtr->digits > TCL_MAX_PREC) { + Tcl_AppendResult(interp, "too large -digits value", NULL); + continue; + } else { + ComputeFormat(scalePtr); + } scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0; @@ -888,7 +893,7 @@ static void ComputeScaleGeometry( register TkScale *scalePtr) /* Information about widget. */ { - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, x, y, extraSpace; Tk_FontMetrics fm; @@ -1304,7 +1309,7 @@ ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; sprintf(string, scalePtr->format, scalePtr->value); scalePtr->flags |= SETTING_VAR; diff --git a/tests/scale.test b/tests/scale.test index 657f668..527b319 100644 --- a/tests/scale.test +++ b/tests/scale.test @@ -35,6 +35,7 @@ foreach test { {-command "set x" {set x} {} {}} {-cursor arrow arrow badValue {bad cursor spec "badValue"}} {-digits 5 5 badValue {expected integer but got "badValue"}} + {-digits 17 17 18 {too large -digits value}} {-fg #00ff00 #00ff00 badValue {unknown color name "badValue"}} {-font fixed fixed {} {font "" doesn't exist}} {-foreground green green badValue {unknown color name "badValue"}} |