Artifacts Associated With Ticket 218911
Ticket change [9430905c85] (rid 105943) by nobody on 2000-10-26 01:07:47:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2678 Bug Version: 8.2 SubmitDate: '1999-08-31' LastModified: '1999-09-01' Severity: LOW Status: Released Submitter: techsupp ChangedBy: hobbs OS: Other Machine: NA FixedDate: '1999-09-01' ClosedDate: '2000-10-25' Name: Peter Spjuth ReproducibleScript: # s1 is a string with "normal" chars set s1 gurka # Give it an internal string rep. string length $s1 # s1 contains unicode char set s2 måla string length $s2 append s1 $s2 # After the append, the internal string object erroneously is set up # as a one-byte-per-char string. String index uses this and indexes # directly, and misses one step. puts "This: '[string index $s1 8]', should be an 'a'." ObservedBehavior: Append messes up the string object and causes string index to give the wrong answer. The bug is in Tcl_AppendObjToObj which does not check uallocated when it tries to determine if the appended string is one-byte-per-char. Patch: Index: tclStringObj.c =================================================================== RCS file: /cvsroot/tcl/generic/tclStringObj.c,v retrieving revision 1.12 diff -c -r1.12 tclStringObj.c *** tclStringObj.c1999/06/16 00:47:561.12 --- tclStringObj.c1999/08/31 18:11:05 *************** *** 920,926 **** numChars = stringPtr->numChars; if ((numChars >= 0) && (appendObjPtr->typePtr == &tclStringType)) { stringPtr = GET_STRING(appendObjPtr); ! if (stringPtr->numChars >= 0) { numChars += stringPtr->numChars; allOneByteChars = 1; } --- 920,926 ---- numChars = stringPtr->numChars; if ((numChars >= 0) && (appendObjPtr->typePtr == &tclStringType)) { stringPtr = GET_STRING(appendObjPtr); ! if (stringPtr->numChars >= 0 && stringPtr->uallocated == 0) { numChars += stringPtr->numChars; allOneByteChars = 1; } PatchFiles: tclStringObj.c Confirmed and fixed for 8.2.1. -- 09/01/1999 hobbs - foundin initialized to: "obsolete: 8.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "Bug in append"
- type initialized to: "Bug"
Ticket change [1c4eb8806d] (rid 90576) by welch on 2000-10-26 08:31:16:
- closedate changed to: "2000-10-26T01:31:16"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [824f65db71] (rid 117215) by dgp on 2001-04-19 03:15:03:
- subsystem changed to: "10. Objects"
Ticket change [1d6a75a60f] (rid 90799) by dgp on 2001-04-19 03:15:04:
- closedate changed to: "2001-04-18T20:15:04"
- closer changed to: "dgp"