Artifacts Associated With Ticket cb90038a637ed2ff
Ticket change [e673a77b8e] (rid 198260) by chrstphrchvz on 2022-02-17 15:24:10:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
This command (as does test expr-34.22) triggers signed integer overflow (undefined behavior) when <tt>long</tt> is 32-bit: <blockquote><pre> % ::tcl::mathop::% -0x80000000 3 <span style="font-weight:bold">tcl/generic/tclExecute.c:6289:24:<span style="color:red"> runtime error: </span>signed integer overflow: 3 * -715827883 cannot be represented in type 'long int'</span> <span style="font-weight:bold">tcl/generic/tclExecute.c:6289:15:<span style="color:red"> runtime error: </span>signed integer overflow: -2147483648 - 2147483647 cannot be represented in type 'long int'</span> 1 </pre></blockquote> Similar issue for this command (and test expr-36.22) for 64-bit <tt>long long</tt>: <blockquote><pre> % ::tcl::mathop::% -0x8000000000000000 3 <span style="font-weight:bold">tcl/generic/tclExecute.c:8547:23:<span style="color:red"> runtime error: </span>signed integer overflow: -3074457345618258603 * 3 cannot be represented in type 'long long int'</span> <span style="font-weight:bold">tcl/generic/tclExecute.c:8547:14:<span style="color:red"> runtime error: </span>signed integer overflow: -9223372036854775808 - 9223372036854775807 cannot be represented in type 'long long int'</span> 1 </pre></blockquote> The attached patch uses the corresponding unsigned types to accommodate overflow in these edge cases.
- foundin initialized to: "core-8-6-branch"
- is_private initialized to: "0"
- login: "chrstphrchvz"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "chrstphrchvz"
- subsystem initialized to: "48. Number Handling"
- title initialized to:
signed integer overflow during expr-34.22, expr-36.22
- type initialized to: "Patch"
Add attachment "cb90038a63.diff" [dbeda56373] (rid 198261) by chrstphrchvz on 2022-02-17 15:26:10.
Ticket change [1631d54687] (rid 198435) by jan.nijtmans on 2022-02-23 15:50:38:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2459634.16016666"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed [42d07d1fe556c48a|here] Thanks for the report and the patch
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"