Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-03-06
16:16 • Closed ticket [4789e18fcb]: signed integer overflow during obj-31.6 plus 7 o... artifact: 1037e654e5 user: jan.nijtmans
16:10
Fix [4789e18fcb]: signed integer overflow during obj-31.6 check-in: 7913cae186 user: jan.nijtmans tags: core-8-6-branch
2022-02-17
09:52 • Ticket [4789e18fcb] signed integer overflow during obj-31.6 status still Ope... artifact: 1d5fee5fa6 user: chrstphrchvz
00:12 • Add attachment obj-31.6-overflow.diff to ticket [4789e18fcba7534c|4789e... artifact: 597e2e82a2 user: chrstphrchvz
00:12 • New ticket [4789e18fcb] signed integer overflow during obj-31.6. artifact: 791cc4c907 user: chrstphrchvz
2013-02-28
13:39 • New ticket [3606391fff] trace.test test independence. artifact: cbd1c82e04 user: dgp

signed integer overflow during obj-31.6

Closed / Fixed4789e18fcba7534cf2ca908eee2cca032e955c6eCreated 5 years agoUpdated 5 years ago
Descriptionwiki2022-02-17 00:12:05
This command (equivalent to test obj-31.6) triggers signed integer overflow (undefined behavior), which the attached patch addresses:
% string index {} end--0x80000000    
tcl/generic/tclUtil.c:3846:15: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
tcl/generic/tclUtil.c:3770:26: runtime error: signed integer overflow: -1 + -2147483648 cannot be represented in type 'int'
Referenced by1
chrstphrchvzwiki2022-02-17 09:52:53

Does the patch address the existing overflow concerns in SetEndOffsetFromAny(), or did those refer to something else (e.g. whether an overflow made sense as a useful result)?

jan.nijtmanswiki2022-03-06 16:16:27

Thanks! Fixed now in [7913cae186572c3d].

This problem was already fixed in Tcl 8.7, thanks to TIP #502. Your patch does nothing more than eliminate the warnings using type-casts, it doesn't change the result for 8.6, so that's OK for 8.6.

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