Overview
| Artifact ID: | 8543f7b80740df845996d3c9880c462807cacb4b70ce56fb4cfbac6f8c61b7ba |
|---|---|
| Ticket: | d282fcacd1ed9936b62dab381c2fe0d1eae41d3d
signed integer overflow in ScanNumber() |
| User & Date: | chrstphrchvz on 2022-02-17 06:17:58 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
UBSan (<tt>-fsanitize=shift-base</tt>) errors for 32-bit <tt>long</tt>: <blockquote><pre> % binary scan \x00\x00\x00\x80 i myvar <span style="font-weight:bold">tcl/generic/tclBinary.c:2105:28:<span style="color:red"> runtime error: </span>left shift of 128 by 24 places cannot be represented in type 'long int'</span> 1 % binary scan \x80\x00\x00\x00 I myvar <span style="font-weight:bold">tcl/generic/tclBinary.c:2110:29:<span style="color:red"> runtime error: </span>left shift of 128 by 24 places cannot be represented in type 'long int'</span> 1 </pre></blockquote> This can be avoided by casting at least the most significant source byte to <tt>unsigned long</tt> before shifting; see attached patch.
- foundin changed to: "core-8-6-branch"
- is_private changed to: "0"
- login: "chrstphrchvz"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "chrstphrchvz"
- subsystem changed to: "16. Commands A-H"
- title changed to: "signed integer overflow in ScanNumber()"
- type changed to: "Patch"