| Ticket UUID: | 526b01c0b9921b90618f82c398dc2684a60a053a | ||
| Title: | lset with 2+ indices on an unshared lseq list is a use-after-free (crash) | ||
| Type: | Bug | Created on: | 2026-10-18 09:48:35 |
| Submitter: | rocketship98 | Assigned to: | nobody |
| Subsystem: | 14. List Object | Severity: | Severe |
| Priority: | 7 High | Last modified: | 2026-10-18 11:03:01 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | 9.0.5, 9.1.0 | ||
| Description: | ||||
On an -O2 build the loop segfaults (TclThreadAllocObj, object pool corrupted).
On a Same with Cause: in TclLsetFlat, Found by mutation testing of the abstract-list code (using claude, so can't say i understand his reasoning). But it crashes my windows wish91.exe | ||||
| User Comments: | ||||
serhiy.storchaka added on 2026-10-18 10:19:50:
Confirmed on trunk and 9.0.5, and the analysis is right. Proposed fix in branch lset-abstract-list-uaf: TclLsetFlat() holds a reference to the sublist while storing it, the first option suggested here. Tests lset-19.1 and 19.2. juliannoble2 added on 2026-10-18 11:03:01:
Verified on one of APN's tclsfe9.1 builds and my own Tcl 9.0 builds (using non-standard zig build system)
Can crash even without the for loop in an interactive tclsh
set l [lseq 5]
lset l 1 0 X
or sometimes repeat the lset command.
| ||||
