Overview
| Artifact ID: | 83dec42e62157a8a5a36a3d3de45944479009a02 |
|---|---|
| Ticket: | 1366195fffffffffffffffffffffffffffffffff
Use TCL_DSTRING_STATIC_SIZE rather than assume size |
| User & Date: | afredd on 2005-11-25 10:40:37 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
A nice easy one... On windows, if you redefine TCL_DSTRING_STATIC_SIZE to be small (4!) then it crashes in TclpGetEncodingNameFromEnvironment because it assumes the DString buffer is large enough. I've not seen anything stating a minimum size for this so assume this is 'allowed'. Something like: TclpGetEncodingNameFromEnvironment(bufPtr) Tcl_DString *bufPtr; { Tcl_DStringInit(bufPtr); +#define MIN_DSTRING_LEN (3 + TCL_INTEGER_SPACE) +#if TCL_DSTRING_STATIC_SIZE < MIN_DSTRING_LEN + Tcl_DStringSetLength(bufPtr, MIN_DSTRING_LEN); +#endif wsprintfA(Tcl_DStringValue(bufPtr), "cp%d", GetACP ()); return Tcl_DStringValue(bufPtr); } seems like the simplest fix, as not many people are going to hit this problem. After hittng this problem i had a quick look for any other potentially similar problems and saw this in tclWinDde.c: #line 367 Tcl_DStringSetLength(&dString, offset + TCL_INTEGER_SPACE); I think this should be: Tcl_DStringSetLength(&dString, Tcl_DStringLength(&dString) + offset + TCL_INTEGER_SPACE); ...but again it's only a problem if TCL_DSTRING_STATIC_SIZE is small. - foundin changed to: "obsolete: 8.5a3"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "afredd"
- subsystem changed to: "None"
- title changed to: "win: if TCL_DSTRING_STATIC_SIZE is small => crash"
- type changed to: "RFE"