Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-10-06
10:23 • Closed ticket [e32a44e2e4]: Tcl_Merge(): signed integer overflow plus 7 othe... artifact: d9507643c5 user: jan.nijtmans
09:06
Fix [e32a44e2e4], [1599352cca], [5ec43cfd9b] and [74cc95b563] check-in: 0e2b23ff84 user: jan.nijtmans tags: core-8-6-branch
2022-10-02
11:28 • Add attachment e32a44e2e49e.diff to ticket [e32a44e2e49e5fe3|e32a44e2e4... artifact: 4889a11e21 user: chrstphrchvz
11:26 • New ticket [e32a44e2e4] Tcl_Merge(): signed integer overflow. artifact: a4b175c4b6 user: chrstphrchvz

Tcl_Merge(): signed integer overflow

Closed / Fixede32a44e2e49e5fe3a21162db2b2dd915ba8589d5Created 4 years agoUpdated 4 years ago
Descriptionwiki2022-10-02 11:26:50
Example script (not much usage of Tcl_Merge() in core Tcl):
set 1k_spaces [string repeat { } [::tcl::mathop::<< 1 10]]
set 1M_spaces [string repeat $1k_spaces [::tcl::mathop::<< 1 10]]
set 1G_spaces [string repeat $1M_spaces [::tcl::mathop::<< 1 10]]

testpanic $1G_spaces $1G_spaces

Output containing UBSan error, which the attached patch avoids:

$ ./tcltest script.tcl
(some time passes)
tcl/generic/tclUtil.c:1596:14: runtime error: signed integer overflow: 1073741826 + 1073741826 cannot be represented in type 'int'
max size for a Tcl value (2147483647 bytes) exceeded
(tcltest aborts, though before TestpanicCmd() can directly call Tcl_Panic().)
Referenced by1
jan.nijtmanswiki2022-10-06 10:23:32

Should be fixed [here]

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

Attachments: