Artifacts Associated With Ticket 7deeddb36
Ticket change [6d48050bb8] (rid 198151) by chrstphrchvz on 2022-02-16 08:57:16:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
Setting <tt>Tcl_WideInt wideValue</tt> to the highest value representable by <tt>Tcl_WideInt</tt> and then doing <tt>wideValue++</tt> is signed integer overflow (undefined behavior). UBSan (<tt>-fsanitize=signed-integer-overflow</tt>) error when <tt>Tcl_WideInt</tt> is <tt>long long</tt>: <blockquote><pre> % scan -0x18000000000000000 {%li} <span style="font-weight:bold">tcl/generic/tclScan.c:926:13:<span style="color:red"> runtime error: </span>signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long long int'</span> -9223372036854775808 </pre></blockquote> Likewise when <tt>Tcl_WideInt</tt> is <tt>long</tt>: <blockquote><pre> % scan -0x18000000000000000 {%li} <span style="font-weight:bold">tcl/generic/tclScan.c:926:13:<span style="color:red"> runtime error: </span>signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'Tcl_WideInt' (aka 'long')</span> -9223372036854775808 </pre></blockquote> Increment only after casting to <tt>Tcl_WideUInt</tt> if wraparound behavior is desired (without e.g. <tt>-fwrapv</tt>); see attached patch. - 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: "23. [scan]"
- title initialized to: "signed integer overflow in Tcl_ScanObjCmd()"
- type initialized to: "Patch"
Add attachment "scanobjcmd-widemin.diff" [36c85fa3ae] (rid 198152) by chrstphrchvz on 2022-02-16 08:57:41.
Ticket change [66a50f8b92] (rid 198167) by jan.nijtmans on 2022-02-16 14:34:58:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2459627.10761991"
- closer changed to: "jan.nijtmans"
- icomment:
Fixed [0ac2e76e3f0b21cd|here] Thanks for the report!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [7824bcad74] (rid 198197) by chrstphrchvz on 2022-02-17 02:26:48:
- closedate changed to: "2459627.60194681"
- closer changed to: "chrstphrchvz"
- icomment:
I now notice the <tt>WIDE_MIN</tt> and <tt>WIDE_MAX</tt> macros in tclPort.h; should those be used instead for consistency? See use-wide-macros.diff.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"
Add attachment "use-wide-macros.diff" [9eb3d05c0a] (rid 198198) by chrstphrchvz on 2022-02-17 02:27:54.