| Ticket UUID: | 3417012 | |||
| Title: | Segfault if [scale]'s -digits parameter value too large. | |||
| Type: | Bug | Version: | None | |
| Submitter: | stwo | Created on: | 2011-10-02 00:40:38 | |
| Subsystem: | 15. [scale] | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2014-10-30 15:27:54 | |
| Resolution: | Fixed | Closed By: | dgp | |
| Closed on: | 2014-10-30 15:27:54 | |||
| Description: |
Example: scale .s -digits 1000 will segfault or scale .s -digits <somelargenumber> ; .s get will segfault | |||
| User Comments: |
dgp added on 2014-10-30 15:27:54:
Fix committed to active branches. dgp added on 2014-10-30 15:02:18: So long as ComputeFormat() or its callers keep bad values out of scalePtr->format, the code in those other files will be OK. They should get the PRINT_CHARS -> TCL_DOUBLE_SPACE change, though, and then PRINT_CHARS should go away. Longer term, Tk ought get out of the practice of using sprintf(), and if Tcl doesn't offer a public routine to replace it, it should. (Tcl_PrintDouble() isn't quite right, due to the impact of tcl_precision.) For now, though, segfaults are bad, and any fix is better than keeping one around. dgp added on 2014-10-30 14:33:55: Is it better to raise an error when the value is too big? Or should we provide the same fallback as when the value is <= 0 -- an autosetting of the format? dgp added on 2014-10-30 14:32:41: Is it better to raise an error when the value is too big? Or should we provide the same fallback as when the value is <= 0 -- an autosetting of the format? dgp added on 2014-10-30 13:48:51: False alarm. Tested the pre-patched library by mistake. dgp added on 2014-10-30 13:42:47: Holy Moley! Still crashing on my linux. Looking.... fvogel added on 2014-10-30 07:55:16: Now tested (and bug fixed) on Linux as well. No further change was needed. generic/tkscale.c is used on both Windows and Linux. In what situations are macosx/tkUnixScale.c and unix/tkMacOSXScale.c exercised rather than generic/tkscale.c ? There is pretty much the same issue in these files, but I would need a test case. fvogel added on 2014-10-29 23:15:25: This crash is due to sprintf trying to use a character buffer having too small a size for containing all the digits specified by the format string. Fix proposal in branch bug-3417012fff for your review. So far tested on Windows only. I plan to completely get rid of: #define PRINT_CHARS 150 I will investigate the five remaining places where this is used, in tkUnixScale.c and tkMacOSXScale.c | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki