Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8543f7b80740df845996d3c9880c462807cacb4b70ce56fb4cfbac6f8c61b7ba
Ticket: d282fcacd1ed9936b62dab381c2fe0d1eae41d3d
signed integer overflow in ScanNumber()
User & Date: chrstphrchvz on 2022-02-17 06:17:58
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. 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.
    
  5. foundin changed to: "core-8-6-branch"
  6. is_private changed to: "0"
  7. login: "chrstphrchvz"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "chrstphrchvz"
  13. subsystem changed to: "16. Commands A-H"
  14. title changed to: "signed integer overflow in ScanNumber()"
  15. type changed to: "Patch"