Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 15d56f773ccab23c76b381e900e6df3e4114eb669f01f71fa0198e0626c82bc3
Ticket: 74cc95b563dd5450eac9e0ea9c8ad1e4273c9d41
UpdateStringOfDict(): signed integer overflow
User & Date: chrstphrchvz on 2022-10-04 06:31:42
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    …which these example scripts trigger and the attached patch prevents:
    
    <ul>
    <li><pre>
    # s has string representation with length INT_MAX-1
    set s &#91;string repeat &#91;string repeat {a} 14949&#93; 143654&#93;
    set d1 &#91;dict create aa $s&#93;
    puts &#91;string is upper $d1&#93;
    </pre>
    
    <pre>
    <span style="font-weight:bold">tcl/generic/tclDictObj.c:539:14: <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 aborts)
    </li>
    <li><pre>
    # s has string representation with length INT_MAX-1
    set s &#91;string repeat &#91;string repeat {a} 14949&#93; 143654&#93;
    set d2 &#91;dict create a $s z {}&#93;
    puts &#91;string is upper $d2&#93;
    </pre>
    
    <pre>
    <span style="font-weight:bold">tcl/generic/tclDictObj.c:531:14: <span style="color:firebrick">runtime error:</span> signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'</span>
    max size for a Tcl value (2147483647 bytes) exceeded
    </pre>
    (tclsh aborts)
    </li>
    </ul>
    
  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: "15. Dict Object"
  14. title changed to: "UpdateStringOfDict(): signed integer overflow"
  15. type changed to: "Patch"