diff options
author | dgp <dgp@users.sourceforge.net> | 2014-10-30 15:26:42 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-10-30 15:26:42 (GMT) |
commit | 56e5cece3f50562969449e4357e5dc1cf3907c1a (patch) | |
tree | c02cfebbe3bcc52d1170176fc41c1f6b977ed2ac /generic/tkScale.c | |
parent | 2de899be4f282336d57ace6810563233c87b13d6 (diff) | |
parent | 277e4c03ced86ddf627807595297854fac523c9a (diff) | |
download | tk-56e5cece3f50562969449e4357e5dc1cf3907c1a.zip tk-56e5cece3f50562969449e4357e5dc1cf3907c1a.tar.gz tk-56e5cece3f50562969449e4357e5dc1cf3907c1a.tar.bz2 |
[3417012] Stop [scale] segfault when -digits too big. Thanks fvogel.
Diffstat (limited to 'generic/tkScale.c')
-rw-r--r-- | generic/tkScale.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c index 7d72990..cc7c294 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -800,6 +800,9 @@ ComputeFormat( */ numDigits = scalePtr->digits; + if (numDigits > TCL_MAX_PREC) { + numDigits = 0; + } if (numDigits <= 0) { if (scalePtr->resolution > 0) { /* @@ -880,7 +883,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; @@ -1296,7 +1299,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; |