Skip to content
Tcl Source Code History Of Ticket 3837178c2548d802
Login

History Of Ticket 3837178c2548d802

Artifacts Associated With Ticket 3837178c2548d802

  1. Ticket change [01c37693a7] (rid 214673) by chrstphrchvz on 2023-05-07 02:39:51:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      <tt>Tcl_DStringSetLength()</tt> previously treated negative <tt>length</tt> as 0 (an undocumented behavior some found concerning: [2613599]). The check for negative <tt>length</tt> was removed when TIP 494 made <tt>length</tt> unsigned (originally in [6d05288cf774], partially restored in [c0829cbacc86], and removed again in [84a5f246b739]). TIP 660 changed <tt>length</tt> back to signed without restoring the check for negative <tt>length</tt>, which at a minimum allows writing <tt>'\0'</tt> out-of-bounds.
      
      Please consider adding the following (or similar) to tests/dstring.test in all maintained branches, regardless of what is done about this ticket:
      
      <blockquote><pre>
      test dstring-4.3 {truncation} -constraints testdstring -setup {
          testdstring free
      } -body {
          testdstring append "xwvut" -1
          # Pass a negative length to Tcl_DStringSetLength();
          # if not caught, causing '\0' to be written out-of-bounds,
          # try corrupting dsPtr-&gt;length which begins
          # 2*sizeof(Tcl_Size) bytes before dsPtr->staticSpace[],
          # so that the result is -256 (on little endian systems)
          # rather than e.g. -8 or -16.
          # (sizeof(Tcl_Size) does not seem to be available via Tcl,
          # so assume sizeof(Tcl_Size) == sizeof(void*) for Tcl 9.)
          testdstring trunc [expr {-2*([package vsatisfies $tcl_version 9.0-]
      	? $tcl_platform(pointerSize) : 4)}]
          list [testdstring get] [testdstring length]
      } -cleanup {
          testdstring free
      } -result {{} 0}
      </pre></blockquote>
      
    5. foundin initialized to: "trunk"
    6. is_private initialized to: "0"
    7. login: "chrstphrchvz"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "6133eb3026f9b10aa9b7b48da92ae2834fc225b0"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "chrstphrchvz"
    14. subsystem initialized to: "11. Conversions from String"
    15. title initialized to:
      Tcl_DStringSetObjLength(): TIP 660 out-of-bounds write
      
    16. type initialized to: "Bug"
  2. Ticket change [558b262cb0] (rid 214694) by jan.nijtmans on 2023-05-07 20:41:20:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      All branches have this test-case now, and `Tcl_DStringSetLength()` is now restored in 9.0. Thanks! Let's think about it, how it should be
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  3. Ticket change [e255baf9fb] (rid 215024) by apnadkarni on 2023-05-17 14:17:28:

    1. icomment:
      I think this particular check is already on the [bug-c9663296fd] branch along with other missing overflow checks in the DString code.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  4. Ticket change [99e4db7497] (rid 216294) by chrstphrchvz on 2023-07-08 12:00:03:

    1. icomment:
      The check appeared on the bug-c9663296fd branch as part of a merge from main: [b4827791dced]
      
      I am fine with this ticket being closed if there is nothing else to do for it. I have not encountered nor looked for similar issues.
      
    2. login: "chrstphrchvz"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [993e08e70a] (rid 253775) by apnadkarni on 2026-05-22 10:36:31:

    1. closedate changed to: "2461182.9420256252"
    2. closer changed to: "apnadkarni"
    3. icomment:
      Both the check and the test are present in current versions so closing.
      
    4. login: "apnadkarni"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"