Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 810e8383ad38109289d7eec28dcc9efb690f68c71ad61f8bd70f81e72a845c17
Ticket: b6afa337376342ff91953f200db89ff4ff4f5fe6
signed integer overflow in TclInitStringRep() macro
User & Date: chrstphrchvz on 2022-02-19 13:49:20
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    
    Example script and corresponding output with UBSan error (<tt>-fsanitize=signed-integer-overflow</tt>, excludes any previously reported errors):
    
    <blockquote><pre>
    proc p {} {
    set a &#91;string repeat &#91;string repeat a 1023&#93; 1049601&#93;
    set a2 &#91;string cat a $a $a&#93;
    return &#91;string toupper $a2&#93;
    }
    set x &#91;p&#93;
    </pre>
    <pre>
    <span style="font-weight:bold">tcl/generic/tclExecute.c:5520:6:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'</span>
    </pre>(tclsh eventually exited normally)</blockquote>
    
    
    Can be prevented with same approach used in [a03e9793d4]; 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: "10. Objects"
  14. title changed to:
    signed integer overflow in TclInitStringRep() macro
    
  15. type changed to: "Patch"