Tcl Source Code

View Ticket
Login
2026-11-14
19:04 • Closed ticket [40f628e8e3]: Tcl_ListObjReplace() callers fail to handle errors (... artifact: 708845448c user: oehhar
19:03
[40f628e8e3] Tcl_ListObjReplace() and oo:define LIST_MAX overflow error handling check-in: 72ed6aee5f user: oehhar tags: core-9-0-branch
19:01
[40f628e8e3] Tcl_ListObjReplace() and oo:define LIST_MAX overflow error handling check-in: f926577551 user: oehhar tags: trunk, main
18:45
[40f628e8e3] Tcl_ListObjReplace() and oo:define LIST_MAX overflow error handling closed check-in: f00c9673c5 user: oehhar tags: oo-define-list-overflow
2026-10-14
18:44 • Ticket [40f628e8e3] Tcl_ListObjReplace() callers fail to handle errors (LIST_MAX... artifact: 16cb93ece7 user: serhiy.storchaka
18:43
Fix [40f628e8e3] in oo::define: check the result of Tcl_ListObjReplace() in MagicDefinitionInvoke(),... check-in: fa198b47b0 user: serhiy.storchaka tags: oo-define-list-overflow
2015-11-20
16:44 • Ticket [40f628e8e3] Tcl_ListObjReplace() callers fail to handle errors (LIST_MAX... artifact: ccb0c05e5d user: dgp
16:42
[40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR. check-in: fe18292f8d user: dgp tags: trunk
15:47
[40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR. check-in: 0ff70f4013 user: dgp tags: core-8-5-branch
15:01 • Ticket [40f628e8e3] Tcl_ListObjReplace() callers fail to handle errors (LIST_MAX... artifact: c45c5d87db user: dgp
14:55 • Ticket [40f628e8e3]: 3 changes artifact: 7018efba98 user: dgp
2015-11-19
20:26 • Ticket [40f628e8e3]: 3 changes artifact: e847913b7c user: dgp
20:16 • New ticket [40f628e8e3]. artifact: af0d71ab78 user: dgp

Ticket UUID: 40f628e8e343f5e3cbef0cd41dff719ef2a11e34
Title: Tcl_ListObjReplace() callers fail to handle errors (LIST_MAX) properly
Type: Bug Created on: 2015-11-19 20:16:41
Submitter: dgp Assigned to: dkf
Subsystem: 14. List Object Severity: Severe
Priority: 5 Medium Last modified: 2026-11-14 19:04:38
Status: Closed Closed by: oehhar
Resolution: Fixed Closed on: 2026-11-14 19:04:38
Version: trunk
Description:
% set l [lrepeat 268435455 A]; concat
% set m [linsert $l end {*}$l]; concat
% llength $m
268435455

This ought to panic on an attempt to make 
a list longer than LIST_MAX.
User Comments:
dgp added on 2015-11-19 20:26:36:
Sorry.  ought to error, not panic.

dgp added on 2015-11-20 14:55:10:
Same botch in different clothing:

% set l [lrepeat 300000000 A]; concat
% set m [concat $l $l]; concat
% llength $m
300000000

dgp added on 2015-11-20 16:44:22:
Mostly fixed, [oo::*define] and [self] might
still have some extreme low probability issue here.

serhiy.storchaka added on 2026-10-14 18:44:45:

The remaining unchecked call was in [oo::define] (MagicDefinitionInvoke(), with a "TODO: overflow?" comment): if Tcl_ListObjReplace() failed, the following Tcl_EvalObjv() would read past the end of the list elements. Proposed fix in branch oo-define-list-overflow.

I did not find similar issues in [self]: other unchecked appends in TclOO build small lists (introspection results) which cannot reach LIST_MAX.


oehhar added on 2026-11-14 19:04:38:

Fix looks reasonable. No additional test failures.

Merged to:

  • main [f9265775]
  • core-9-0-branch [72ed6aee]

Bug closing.

Thanks, Harald