Skip to content
Tcl Source Code History Of Ticket 1599352cca
Login

History Of Ticket 1599352cca

Artifacts Associated With Ticket 1599352cca

  1. Ticket change [f65dc39c7e] (rid 204950) by chrstphrchvz on 2022-10-02 14:04:32:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Although it only makes sense to provide nonnegative <tt>argc</tt> to  <tt>Tcl_Merge()</tt>, the function is a public API currently making no effort to guard against negative <tt>argc</tt>.
      
      <ul><li>When <tt>argc</tt> is negative, there is signed integer overflow in the expression <tt>INT_MAX - argc + 1</tt>.</li>
      
      <li>(Assuming 32-bit <tt>int</tt>.) If <tt>argc == INT_MIN</tt>, the current behavior is to allocate a 2GiB buffer and then write <tt>'\0'</tt> to the byte prior to the beginning of buffer. Otherwise, if <tt>INT_MIN &lt; argc &amp;&amp; argc &lt; 0</tt>, then the function panics, claiming <tt>max size for a Tcl value (2147483647 bytes) exceeded</tt>.</li></ul>
      
      At a minimum, I would suggest changing the behavior of the function slightly so that it always panics to prevent the out-of-bounds write; panicking is already possible in that case during the <tt>ckalloc(INT_MIN)</tt> call. Maybe a more helpful panic message can be used. See attached patch for a possible solution.
      
    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: "14. List Object"
    14. title initialized to:
      Tcl_Merge(): out-of-bounds write, more signed integer overflow
      
    15. type initialized to: "Patch"
  2. Add attachment "1599352cca83.diff" [baf3c5a6bb] (rid 204952) by chrstphrchvz on 2022-10-02 14:06:20.

  3. Ticket change [9dfc7dd265] (rid 205040) by jan.nijtmans on 2022-10-06 10:23:08:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2459858.93273367"
    3. closer changed to: "jan.nijtmans"
    4. icomment: "Should be fixed [0e2b23ff845b1e1b|here]"
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
  4. Ticket change [6fd5b1699d] (rid 205056) by chrstphrchvz on 2022-10-06 20:06:36:

    1. closedate changed to: "2459859.33791972"
    2. closer changed to: "chrstphrchvz"
    3. icomment:
      [0e2b23ff845b] does fix quite a few issues, including some I had suspected or had not yet reported.
      
      However there is still the issue of <tt>argc == INT_MAX</tt> leading to an out-of-bounds write. Is this won't-fix for Tcl < 9.0?
      
    4. login: "chrstphrchvz"
    5. mimetype: "text/x-fossil-wiki"
  5. Ticket change [e7689f573f] (rid 205057) by chrstphrchvz on 2022-10-06 20:17:44:

    1. closedate changed to: "2459859.34565304"
    2. icomment:
      I meant <tt>argc == INT_MIN</tt> in the previous comment.
      
    3. login: "chrstphrchvz"
    4. mimetype: "text/x-fossil-wiki"
  6. Ticket change [19856075b2] (rid 205064) by jan.nijtmans on 2022-10-07 11:20:03:

    1. closedate changed to: "2459859.97225919"
    2. closer changed to: "jan.nijtmans"
    3. icomment: "Should be better now: [63b0443866958521]"
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"