Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 622614b5bb284b50adde38a3cec632adb85c3f792da9fbea040f487436c460a8
Ticket: 983f933f114af3a77d9df39359205811637ee2c2
source test triggers undefined behavior
User & Date: chrstphrchvz on 2025-12-26 23:06:52
Changes

  1. icomment:
    Would something like the following be an appropriate fix?
    
    ```
    --- a/generic/tclUtil.c
    +++ b/generic/tclUtil.c
    @@ -4255,8 +4255,12 @@ TclGetProcessGlobalValue(
     	 * in our epoch-indexed cache.
     	 */
     
    -	Tcl_ExternalToUtfDString(NULL, pgvPtr->value, pgvPtr->numBytes, &newValue);
    -	value = Tcl_DStringToObj(&newValue);
    +	if (pgvPtr->value) {
    +	    Tcl_ExternalToUtfDString(NULL, pgvPtr->value, pgvPtr->numBytes, &newValue);
    +	    value = Tcl_DStringToObj(&newValue);
    +	} else {
    +	    TclNewObj(value);
    +	}
     	hPtr = Tcl_CreateHashEntry(cacheMap,
     		INT2PTR(pgvPtr->epoch), NULL);
     	Tcl_MutexUnlock(&pgvPtr->mutex);
    ```
    
  2. login: "chrstphrchvz"
  3. mimetype: "text/x-markdown"