Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 4be8979801e6fc4c49a166693adf4f67d726c6849354fac8b1bfac6c264859f4
Ticket: 2570123b6384460203e0456861e04454296acc78
system encoding is not protected from freeing during encode/decode operations
User & Date: apnadkarni on 2025-08-13 17:11:30
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-markdown"
  4. comment changed to:
    Inspecting code, I have doubts about potential crashes from accessing freed encodings in multithreaded environments. Several functions have code similar to below:
    
    ```
    if (encoding == NULL) // encoding is passed by caller
       encoding = systemEncoding; // systemEncoding is GLOBAL shared by threads
    
    Do some operations involving the encoding. 
    
    ```
    
    The issue I am wondering about is that the reference count on systemEncoding is not incremented in such cases. What happens if some other thread calls `encoding system` and changes the systemEncoding causing the original one in use above to be freed?
    
    Need to build a test case to verify above race condition but perhaps someone could corroborate or refute my analysis. And save me the trouble of creating the test case :-)
    
  5. foundin changed to: "8.6"
  6. is_private changed to: "0"
  7. login: "apnadkarni"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "apnadkarni"
  14. subsystem changed to: "- New Builtin Commands"
  15. title changed to:
    system encoding is not protected from freeing during encode/decode operations
    
  16. type changed to: "Bug"