Skip to content
Tcl Source Code History Of Ticket 5be203d6ca
Login

History Of Ticket 5be203d6ca

Artifacts Associated With Ticket 5be203d6ca

  1. Ticket change [c1194e009d] (rid 216172) by jan.nijtmans on 2023-07-03 13:44:15:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Starting with [398de572ab139a49|this] commit, in debug mode:
      <pre>
      ==== io-7.3 FilterInputBytes: split up character at EOF FAILED
      ==== Contents of test case:
      
          set f [open $path(test1) w]
          fconfigure $f -encoding binary
          puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82"
          close $f
          set f [open $path(test1)]
          fconfigure $f -encoding shiftjis -profile tcl8
          set x [list [gets $f line] $line]
          lappend x [tell $f] [testchannel inputbuffered $f] [eof $f]
          lappend x [gets $f line] $line
          close $f
          set x
      
      ---- Result was:
      16 1234567890123\U0000FF10\U0000FF11\xEF\xBC 18 0 1 -1 {}
      ---- Result should have been (exact matching):
      16 1234567890123\U0000FF10\U0000FF11\x82 18 0 1 -1 {}
      ==== io-7.3 FAILED
      </pre>
      
      It doesn't look like this commit actually causes the failure, I suspect this is an already existing bug exposed by this change.
      
      So, this ticket is meant to investigate this bug and - hopefully - fix it.
      
    5. foundin initialized to: "8.7"
    6. is_private initialized to: "0"
    7. login: "jan.nijtmans"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0c50e5320704d174412e57b873d8932de15303e0"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "jan.nijtmans"
    14. subsystem initialized to: "26. Channel Transforms"
    15. title initialized to: "io-7.3 and chanio-7.3 fail in debug mode"
    16. type initialized to: "Bug"
  2. Ticket change [244f538fe4] (rid 216186) by jan.nijtmans on 2023-07-03 14:11:30:

    1. assignee changed to: "jan.nijtmans"
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  3. Ticket change [aa1d28ee04] (rid 216202) by apnadkarni on 2023-07-04 06:58:42:

    1. icomment:
      Jan,
      
      It was the commit that caused failure. A proposed fix is in the [bug-5be203d6ca-apn]. The root cause is that in the case of the truncated prefix byte being the last one, src is incremented again at the bottom of the loop (in addition to the one within the if (prefixByte) condition) making it point beyond srcEnd. The result computation of *srcReadPtr is then obviously wrong.
      
      However, this fix is not final.
      
      First, other decoding functions need to be checked for the same error.
      
      More important, it is not clear to me now why the original code where src was being decremented earlier (as in 8.6) caused the assertion failures in the tests. Is it possible the assertion is itself wrong? I don't understand the io system enough to make a call on that.
      
      /Ashok
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-plain"
  4. Ticket change [f250e81a56] (rid 216207) by jan.nijtmans on 2023-07-04 09:22:49:

    1. assignee changed to: "apnadkarni"
    2. icomment: "Thanks for taking this! I'm as puzzled as you are."
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  5. Ticket change [5450ce057b] (rid 216208) by apnadkarni on 2023-07-04 09:52:03:

    1. icomment:
      Will do.
      
      It is very discomforting that the tclIO code seems to disregard return status from the Tcl encoding functions more often than not. But that's a separate issue.
      
      /Ashok
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  6. Ticket change [2377afb392] (rid 216242) by apnadkarni on 2023-07-05 06:18:43:

    1. icomment:
      Purported fix is in [7a68ac2af7] (8.7) and [4b6fd44d84] (9.0)
      
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-plain"
  7. Ticket change [e9fe3b6fa5] (rid 216243) by oehhar on 2023-07-05 06:28:37:

    1. icomment:
      Great work !
      
      Why do you have ind generic/tclEncoding.c line 3480:
      
      <verbatim>
      if (src >= srcEnd-1) {
      </verbatim>
      
      and not
      
      <verbatim>
      if (src > srcEnd) {
      </verbatim>
      
      Is it the unsigned size_t type?
      
      Do I miss something?
      Thanks,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  8. Ticket change [7767d7f269] (rid 216245) by apnadkarni on 2023-07-05 06:39:03:

    1. icomment:
      The two are not equivalent.
      
      src > srcEnd is same as src >= srcEnd+1, not src >= srcEnd-1
      
      Happens :-)
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  9. Ticket change [308a578dd6] (rid 216250) by apnadkarni on 2023-07-05 10:20:26:

    1. closedate changed to: "2460130.93085829"
    2. closer changed to: "apnadkarni"
    3. login: "apnadkarni"
    4. mimetype: "text/plain"
    5. resolution changed to: "Fixed"
    6. status changed to: "Closed"