Tcl Source Code

View Ticket
Login
Ticket UUID: 66da4d4228be65fea83fa7eb4f9e932b7951341d
Title: Tcl_UtfToExternal buffer overwrite for non-BMP characters using utf-16 encoders
Type: Bug Version: 9.0.0
Submitter: apnadkarni Created on: 2024-10-19 15:51:30
Subsystem: 44. UTF-8 Strings Assigned To: nobody
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2024-10-22 16:59:40
Resolution: Fixed Closed By: apnadkarni
    Closed on: 2024-10-22 16:59:40
Description:

UTF-16 encoders write beyond destination space when encoding non-BMP characters.

% set utf8 [binary decode hex 41f09f988042]; encoding convertfrom utf-8 $utf8
A😀B
% testencoding Tcl_UtfToExternal utf-16le $utf8 {start end} {} 7 nread nwritten nchars
Tcl_UtfToExternal wrote past output buffer
User Comments: apnadkarni added on 2024-10-19 16:21:29:
Proposed fix in [4574a1e8d3]