Skip to content
Tcl Source Code History Of Ticket 69634d51fb
Login

History Of Ticket 69634d51fb

Artifacts Associated With Ticket 69634d51fb

  1. Ticket change [28254a00d7] (rid 182782) by dgp on 2020-04-29 15:40:29:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      The valid range of unicode extends from U+0000 to U+10FFFF.  Routines
      that accept an int argument meant to represent a unicode code point have
      to decide how to handle a value of 0x110000 and above.  One example is
      the routine Tcl_UniCharIsGraph(), but there are many.
      
      Tcl 8.5 routes the handling to the inner workings of GetUniCharInfo(),
      which masks away unacceptable high bits.  This indicates that
      
      Tcl_UniCharIsGraph( 0x200041) will return 1 (masked to make \x41 "A") while
      Tcl_UniCharIsGraph( 0x200020) will return 0 (masked to make \x20 " ").  Since
      these are both invalid inputs, I think it would make more sense to have them
      produce the same results.  In many situations, invalid inputs are transformed
      into U+FFFD, the replacement character. That makes more sense to me.
      
      Moving forward through versions and variants, there are different handlings in place.
      In 8.7, there is masking of the output of routines like Tcl_UniCharToLower,
      when the constraint would seem to be more useful on what comes in instead
      of what goes out.
      
    5. is_private initialized to: "0"
    6. login: "dgp"
    7. priority initialized to: "5 Medium"
    8. resolution initialized to: "None"
    9. severity initialized to: "Minor"
    10. status initialized to: "Open"
    11. submitter initialized to: "dgp"
    12. subsystem initialized to: "44. UTF-8 Strings"
    13. title initialized to: "handling out of range UCS4 values"
    14. type initialized to: "Bug"
  2. Ticket change [5b4e108771] (rid 182783) by dgp on 2020-04-29 15:42:13:

    1. icomment:
      
      Note that masking away high bits doesn't help at all with an input value
      like 0x110000 , which is out of range but keeps all bits after masking.
      We'd at least be worried that such values lead to invalid lookup table
      accesses.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [8b920ae5ee] (rid 182784) by jan.nijtmans on 2020-04-29 16:17:05:

    1. icomment:
      Whenever Tcl accept chars > \xFFFF, there's a UNICODE_OUT_OF_RANGE macro which checks for possible overflow. So there's no possibility for invalid lookup table access.
      
      For Tcl 8.5/8.6, the input 'integer' is masked using 16 bits. This is logical, since those functions are only defined accepting an Tcl_UniChar. In Tcl 8.7 that changes. For reasons of extensability, the input values are now masked using 21 bits. This allows bits 22 up to 31 to used for other purposes. For example Tcl_UniCharToUpper() could become locale-dependant: Uppercase 'i' in turkish is "İ", not "I".   The lowercase form of "I" is "ı", not "i".  So flags could be used in Tcl_UniCharToUpper()/Tcl_UniCharToLower() to indicate whether we want the Turkish variant or the rest-of-the-world variant.
      
      So, I don't think there's a bug here.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
  4. Ticket change [0270590773] (rid 182804) by jan.nijtmans on 2020-04-29 20:58:23:

    1. assignee changed to: "dgp"
    2. icomment:
      I think the range checking is fixed now in Tcl 8.5 and 8.6, for builds with sizeof(Tcl_UniChar) == 4. Backported those bits and pieces from 8.7.
      
      So, if there still are bugs here (I don't think so), that means they still are not fixed in 8.7 either. That's the reason for the differences in branches: Various fixes where never backported to 8.6 and 8.5.
      
      Good luck!
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
    5. resolution changed to: "Fixed"
    6. status changed to: "Pending"
  5. Ticket change [7e4e593bfd] (rid 182857) by dgp on 2020-04-30 14:32:12:

    1. icomment:
      
      The masking of output values from routines like Tcl_UniCharToUpper
      
      https://core.tcl-lang.org/tcl/artifact/16c3f0784c45ed55?ln=1277
      
      seems unnecessary to me.  Harmless, but why bother?
      
      Can we not count on our processing to produce results already valid and
      already clear of any of those extension bits?
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [832431af7c] (rid 182861) by jan.nijtmans on 2020-04-30 15:03:33:

    1. icomment:
      > Can we not count on our processing to produce results already valid and already clear of any of those extension bits?
      
      No we cannot since the UNICODE_OUT_OF_RANGE(), GetUniCharInfo(), GetCaseType() and GetDelta() all do their own masking with 0x1FFFFF already. If we use the additional bits as flags - in the future - then we don't want to see our flags back in the output. That's why we need to mask them away ourselves, the macro's don't do it.
      
      So - please - leave it as-is for now. I'll write a TIP how to handle locale-dependant Tcl_UniCharToUpper() (for e.g. Turkish, I have some ideas on that ...), but it's not high prio now so it might take a while.
      
      Thanks!
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  7. Ticket change [ff2427a1f0] (rid 258137) by serhiy.storchaka on 2026-10-15 11:29:07:

    1. icomment: "Closing: fixed, see above."
    2. login: "serhiy.storchaka"
    3. mimetype: "text/x-fossil-wiki"
    4. status changed to: "Closed"
  8. Ticket change [deefd1a105] (rid 259938) by serhiy.storchaka on 2026-10-22 17:19:26:

    1. closedate changed to: "2461328.978555405"
    2. closer changed to: "serhiy.storchaka"
    3. login: "serhiy.storchaka"