Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f7014b3707b1601d58e40279f0dc301f424ed36325c967bc6849148b83c1a827
Ticket: c9e68eb6ca40bb844b6c5d172a8e203f4b419857
tclEncoding.c: undefined behavior involving NULL pointers
User & Date: chrstphrchvz on 2025-09-20 20:52:41
Changes

  1. icomment:
    The attached patch still applies cleanly to core-8-6-branch, but it seems like core-9-0-branch would need to be a separate effort.
    
    I am also wondering if there is a concern where `NULL != src` should instead not be part of the for loop condition, e.g.:
    
    ```
    @@ -3042,7 +3044,8 @@
         dstStart = dst;
         dstEnd = dst + dstLen - TCL_UTF_MAX;
     
    -    for (numChars = 0; src < srcEnd && numChars <= charLimit; src += 2, numChars++) {
    +    numChars = 0;
    +    if (NULL != src) for (; src < srcEnd && numChars <= charLimit; src += 2, numChars++) {
     	if (dst > dstEnd && !HIGH_SURROGATE(ch)) {
     	    result = TCL_CONVERT_NOSPACE;
     	    break;
    ```
    
  2. login: "chrstphrchvz"
  3. mimetype: "text/x-markdown"