Skip to content
Tcl Source Code History Of Ticket a30d273cfb92ade6
Login

History Of Ticket a30d273cfb92ade6

Artifacts Associated With Ticket a30d273cfb92ade6

  1. Ticket change [da0cfb9316] (rid 198337) by chrstphrchvz on 2022-02-19 09:06:31:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Example scripts and corresponding output with UBSan (<tt>-fsanitize=signed-integer-overflow</tt>) errors:
      
      <ol><li><pre>
      set f &#91;open /dev/zero &#91;list RDONLY BINARY&#93;&#93;
      fconfigure $f -buffersize &#91;expr {2**20}&#93;
      set z &#91;read $f &#91;expr {2**30}&#93;&#93;
      proc as2 {s} {return &#91;string cat &#91;encoding convertto utf-8 a&#93; $s $s&#93;}
      set az2 &#91;as2 $z&#93;
      </pre>
      <pre>
      <span style="font-weight:bold">tcl/generic/tclExecute.c:2770:17:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int'</span>
      max size for a Tcl value (2147483647 bytes) exceeded
      </pre>(tclsh aborted)</li>
      
      
      <li><pre>
      set a &#91;string repeat &#91;string repeat a &#91;expr {2**10}&#93;&#93; &#91;expr {2**20}&#93;&#93;
      proc us2 {s} {return &#91;string cat {u} $s $s&#93;}
      set ua2 &#91;us2 $a&#93;
      </pre><pre>
      <span style="font-weight:bold">tcl/generic/tclExecute.c:2778:17:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int'</span>
      max size for a Tcl value (2147483647 bytes) exceeded
      </pre>(tclsh aborted)</li>
      
      
      <li><pre>
      set a &#91;string repeat &#91;string repeat a 1023&#93; 1049601&#93;
      proc uus2 {s} {return &#91;string cat {uu} $s $s&#93;}
      set uua2 &#91;uus2 $a&#93;
      </pre>
      <pre>
      <span style="font-weight:bold">tcl/generic/tclExecute.c:2812:17:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 2 + 2147483646 cannot be represented in type 'int'</span>
      max size for a Tcl value (2147483647 bytes) exceeded
      </pre>(tclsh aborted)</li>
      
      
      <li><pre>
      set a &#91;string repeat &#91;string repeat a 1023&#93; 1049601&#93;
      proc zs2 {s} {return &#91;string cat &#91;expr 0&#93; $s $s&#93;}
      set za2 &#91;zs2 $a&#93;
      </pre>
      <pre>
      <span style="font-weight:bold">tcl/generic/tclExecute.c:2820:25:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'</span>
      </pre>(tclsh exited normally)</li>
      
      
      <li><pre>
      set a &#91;string repeat &#91;string repeat a 1023&#93; 1049601&#93;
      proc us2 {s} {return &#91;string cat {u} $s $s&#93;}
      set ua2 &#91;us2 $a&#93;
      </pre><pre>
      <span style="font-weight:bold">tcl/generic/tclExecute.c:2827:7:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'</span>
      </pre>(tclsh exited normally)</li>
      
      
      <li><pre>
      set f &#91;open /dev/zero &#91;list RDONLY BINARY&#93;&#93;
      fconfigure $f -buffersize &#91;expr {2**20}&#93;
      set z &#91;read $f &#91;expr {2**30}&#93;&#93;
      proc s2 {s} {return &#91;string cat $s $s&#93;}
      set z2 &#91;s2 $z&#93;
      </pre><pre>
      <span style="font-weight:bold">tcl/generic/tclExecute.c:2848:17:<span style="color:firebrick"> runtime error: </span>signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int'</span>
      max size for a Tcl value (2147483647 bytes) exceeded
      </pre>(tclsh aborted)</li>
      </ol>
      
      The attached patch prevents these.
      
    5. foundin initialized to: "core-8-6-branch"
    6. is_private initialized to: "0"
    7. login: "chrstphrchvz"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "chrstphrchvz"
    13. subsystem initialized to: "18. Commands M-Z"
    14. title initialized to:
      signed integer overflow in TEBCResume() for INST_STR_CONCAT1
      
    15. type initialized to: "Patch"
  2. Add attachment "a30d273cfb.diff" [0e1aefaf7b] (rid 198338) by chrstphrchvz on 2022-02-19 09:07:04.