Overview
| Artifact ID: | 9430905c85e05a8cbf48e7177cd573db513dbf58 |
|---|---|
| Ticket: | 218911ffffffffffffffffffffffffffffffffff
Bug in append |
| User & Date: | nobody on 2000-10-26 01:07:47 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed 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 changed to: "obsolete: 8.2"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "nobody"
- subsystem changed to: "69. Other"
- title changed to: "Bug in append"
- type changed to: "Bug"