Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-03-08
15:18 • Closed ticket [b6afa33737]: signed integer overflow in TclInitStringRep() macro<... artifact: c4773d1c0f user: jan.nijtmans
15:10
Fix [b6afa33737]: signed integer overflow in TclInitStringRep() macro check-in: a314f4ea62 user: jan.nijtmans tags: core-8-6-branch
2022-02-19
13:49 • Add attachment b6afa33737.diff to ticket [b6afa33737] artifact: 751486b033 user: chrstphrchvz
13:49 • New ticket [b6afa33737] signed integer overflow in TclInitStringRep() macro. artifact: 810e8383ad user: chrstphrchvz

signed integer overflow in TclInitStringRep() macro

Closed / Fixedb6afa337376342ff91953f200db89ff4ff4f5fe6Created 5 years agoUpdated 5 years ago
Descriptionwiki2022-02-19 13:49:20
Example script and corresponding output with UBSan error (-fsanitize=signed-integer-overflow, excludes any previously reported errors):
proc p {} {
set a [string repeat [string repeat a 1023] 1049601]
set a2 [string cat a $a $a]
return [string toupper $a2]
}
set x [p]
tcl/generic/tclExecute.c:5520:6: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
(tclsh eventually exited normally)

Can be prevented with same approach used in [a03e9793d4]; see attached patch.

Referenced by1
jan.nijtmanswiki2022-03-08 15:18:30

Fixed [here]. Thanks!

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