Skip to content
Tcl Source Code History Of Ticket 816913a65e
Login

History Of Ticket 816913a65e

Artifacts Associated With Ticket 816913a65e

  1. Ticket change [202b980e5b] (rid 196921) by chrstphrchvz on 2021-12-24 19:11:02:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      In <tt>GrowStringBuffer()</tt> (generic/tclStringObj.c), it is possible for <tt>int attempt</tt> to be assigned <tt>INT_MAX</tt>, such as when the function is called with <tt>int needed = INT_MAX</tt>. When this happens, <tt>int attempt</tt> will also be assigned <tt>INT_MAX</tt>, and <tt>attempt + 1</tt> will overflow (although I do not observe this causing unexpected behavior). [https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks|UBSan (<tt>-fsanitize=signed-integer-overflow</tt>)] error example:
      
      <pre>
      % set dz [open /dev/zero [list RDONLY]]
      % set nulls [read $dz [expr {(1 << 30) - 1}]]
      <span style="font-weight:bold">tcl/generic/tclStringObj.c:167:20: <span style="color:red">runtime error:</span> signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'</span>
      </pre>
      
      If it is indeed okay to allocate <tt>(unsigned int)INT_MAX + 1U</tt>, then some possible ways to avoid overflow include declaring <tt>attempt</tt> as <tt>unsigned int</tt>, or changing instances of <tt>attempt + 1</tt> to promote <tt>attempt</tt> to <tt>unsigned int</tt> (such as by using <tt>attempt + 1U</tt>).
      
    5. foundin initialized to: "8.6.12"
    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: "10. Objects"
    14. title initialized to: "GrowStringBuffer(): signed integer overflow"
    15. type initialized to: "Bug"
  2. Ticket change [18e29634a5] (rid 197067) by jan.nijtmans on 2022-01-13 17:32:06:

    1. assignee changed to: "jan.nijtmans"
    2. icomment: "Possible fix committed [a03e9793d4f70960|here]"
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. resolution changed to: "Fixed"
    6. status changed to: "Pending"
  3. Ticket change [4c61324c39] (rid 197090) by jan.nijtmans on 2022-01-14 22:49:30:

    1. closedate changed to: "2459594.45104711"
    2. closer changed to: "jan.nijtmans"
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"