Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: e3104d5d36f0c49df637231557c4493db8c85114688fcf1573632889296646d6
Ticket: f5eadcbf9a6b1b4cff5aaf0da5aa5706430dfb7c
passing pointer to uninitialized memory leads Tcl_UniCharToUtf() to corrupt data
User & Date: pooryorick on 2023-04-26 02:36:54
Changes

  1. icomment:
    This is not a non-issue.  Commit [a61fef8429dfff4b] was recently moved off trunk due to the fact that it caused test format-2.19 to fail under a build of TCL_UTF_MAX = 3. This bug is the cause of that failure.  In every spot except one "TCL_UTF_MAX < 4" would not be incorrect.  I considered adding those, but I think Tcl_UniCharToUtf() is an example of the type of coding that there should be zero tolerance for, as smuggling flags and state into existing argument turns the code into a booby trap for future developers.
    See [https://web.stanford.edu/~ouster/cgi-bin/cs190-winter18/lecture.php?topic=complexity|The Nature of Complexity] by Jon Ousterhout.
      Instead, the signature of Tcl_UniCharToUtf() should be changed to explicitly support the new functionality.  Also, TCL_UTF_MAX = 3 should be removed from trunk and from Tcl 9.  It no longer serves any purpose, and is responsible for at least this bug.  For whatever reason, valgrind is not picking up on this issue.  
    
    Jan, you won't be able to create a test case for this issue, yet it is real.  After this is fixed and my commit mentioned above is reapplied to trunk, format-2.19 will be one canary for the issue.
    
  2. login: "pooryorick"
  3. mimetype: "text/x-fossil-wiki"