Tcl Source Code

View Ticket
Login
Ticket UUID: 3cd9bea1e66b4fad4b72c61414390c6db2962f6
Title: check-in [43032d7ba3] potential problems
Type: Bug Created on: 2019-12-03 00:41:13
Submitter: chw Assigned to: jan.nijtmans
Subsystem: 44. UTF-8 Strings Severity: Important
Priority: 5 Medium Last modified: 2019-12-03 15:17:02
Status: Closed Closed by: jan.nijtmans
Resolution: Fixed Closed on: 2019-12-03 15:17:02
Version: core-8-6-branch
Description:
From code reading I believe that check-in [43032d7ba3] leaves out corner cases:

* it does not check for the return code of the inner TclParseHex()
* it requires the second "\u.." escape sequence to have 4 hex digits
  (which is a required condition for the low surrogate, no complaints about it)
* but it will accept "\ud83d\uxyyzz" without proper error handling
User Comments:
jan.nijtmans added on 2019-12-03 15:17:02:

Fixed in all branches now. Thanks!

The goal of this is to make it almost impossible to create surrogate-pairs when Tcl is compiled with -DTCL_UTF_MAX>3: We want 4-byte UTF-8 sequences always. Of course you can still work around it like:

    %set x \uD83D
    �
    % append x \uDE00
    😀
I'm sure there are still other ways to create surrogate pairs as two 3-byte sequences, but this should be discouraged.