Skip to content
Tcl Source Code View Ticket
Login

View Ticket

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

Tcl_ListObjReplace() callers fail to handle errors (LIST_MAX) properly

Closed / Fixed40f628e8e343f5e3cbef0cd41dff719ef2a11e34Created 11 years agoUpdated 18 days ago
Descriptionplain2015-11-19 20:16:41
% 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.
Referenced by6
  • 72ed6aee5f[40f628e8e3] Tcl_ListObjReplace() and oo:define LIST_MAX overflow error handling check-in2026-11-14 19:03:04
  • f926577551[40f628e8e3] Tcl_ListObjReplace() and oo:define LIST_MAX overflow error handling check-in2026-11-14 19:01:28
  • f00c9673c5[40f628e8e3] Tcl_ListObjReplace() and oo:define LIST_MAX overflow error handling check-in2026-11-14 18:45:45
  • fa198b47b0Fix [40f628e8e3] in oo::define: check the result of Tcl_ListObjReplace() in MagicDefinitionInvoke(), and pass the real length of the list to Tcl_EvalObjv(). check-in2026-10-14 18:43:54
  • fe18292f8d[40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR. check-in2015-11-20 16:42:57
  • 0ff70f4013[40f628e8e3] Tcl_ListObjReplace() callers need to handle TCL_ERROR. check-in2015-11-20 15:47:30
dgpplain2015-11-19 20:26:36
Sorry.  ought to error, not panic.
dgpplain2015-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 Ticket [40f628e8e3]: 3 changes [History diff]2015-11-20 15:01:37
dgpplain2015-11-20 16:44:22
Mostly fixed, [oo::*define] and [self] might
still have some extreme low probability issue here.
serhiy.storchakawiki2026-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.

oehharwiki2026-11-14 19:04:38

Fix looks reasonable. No additional test failures.

Merged to:

Bug closing.

Thanks, Harald

Log in (anonymous is fine) to add a comment.