Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 566512e7c169bee136e1c200baf31f67d1c257be
Ticket: 67aa9a207037ae67f9014b544c3db34fa732f2dc
Security: Invalid UTF-8 can inject unexpected characters
User & Date: dgp on 2017-06-05 16:56:12
Changes

  1. closedate changed to: "2457910.20569594"
  2. closer changed to: "dgp"
  3. icomment:
    
    From TCLCORE:
    
    "Tcl_UtfToUniChar() is documented as:
        <http://core.tcl.tk/tcl/artifact?ln=142-145&name=eaf0d058d9f17309>
    Text:
        If the input is not in proper UTF-8 format, \fBTcl_UtfToUniChar\fR will
        store the first byte of \fIsrc\fR in \fI*chPtr\fR as a Tcl_UniChar
        between 0x0000 and 0x00ff and return 1.
    
    This turns out to be a lie: Some byte-sequences, which are clearly
    non-proper according to the UTF-8 standard, this function returns
    something else than the first byte. That's what I'm proposing to fix."
    
    Thank you, that's the clear explanation I needed to see.  This is indeed
    a good change to make.  Merged to core-8-6-branch. Will further merge
    forward.
    
    Seems this has been contrary to documentation since it arrived
    in Tcl 8.1.  Possible explanation is a changing standard of
    what is considered "proper UTF-8 format" and whether multiple
    encodings are permissible for the same codepoint?  Clear standard
    now is that they are not.
    
    One thing that might still be improved (?) is to mention the
    exception \xc0 \x80 encoding for U+0000 that the routine
    explicitly makes.
    
  4. login: "dgp"
  5. mimetype: "text/plain"