diff options
author | dgp <dgp@users.sourceforge.net> | 2014-10-30 15:16:37 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-10-30 15:16:37 (GMT) |
commit | 277e4c03ced86ddf627807595297854fac523c9a (patch) | |
tree | 96d54249d6fe3ce0e844f00f245ec68bd1bc653a /generic | |
parent | 90f1bb2871f27fb60b636b4b70b9b6e5f9dc3eda (diff) | |
parent | 69a9c784d764e95b1b34c1b37d7a7df4a4c90647 (diff) | |
download | tk-277e4c03ced86ddf627807595297854fac523c9a.zip tk-277e4c03ced86ddf627807595297854fac523c9a.tar.gz tk-277e4c03ced86ddf627807595297854fac523c9a.tar.bz2 |
[3417012] Stop [scale] segfault when -digits too big.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkScale.c | 7 | ||||
-rw-r--r-- | generic/tkScale.h | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c index 28e5b16..69a7d91 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -808,6 +808,9 @@ ComputeFormat( */ numDigits = scalePtr->digits; + if (numDigits > TCL_MAX_PREC) { + numDigits = 0; + } if (numDigits <= 0) { if (scalePtr->resolution > 0) { /* @@ -888,7 +891,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 +1307,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/generic/tkScale.h b/generic/tkScale.h index f406bf6..a2c5f2b 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -220,12 +220,6 @@ typedef struct TkScale { #define SPACING 2 /* - * How many characters of space to provide when formatting the scale's value: - */ - -#define PRINT_CHARS 150 - -/* * Declaration of procedures used in the implementation of the scale widget. */ |