Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: aea681282d8b6d13c4a0100675ca954ad8553fdf0c763a4c2e4ad5c5d3dd4b99
Ticket: 6cb3db4965ada9d88799c6a652534499bfc9b4a7
pointer arithmetic using NULL in InitArgsAndLocals()
User & Date: chrstphrchvz on 2021-12-28 23:51:25
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    [https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks|UBSan <tt>-fsanitize=pointer-overflow</tt>] error during test event-11.8:
    
    <pre>
    <span style="font-weight:bold">tcl/generic/tclProc.c:1431:30: <span style="color:red">runtime error:</span> applying zero offset to null pointer</span>
    </pre>
    
    Using a ternary expression avoids the error:
    <pre>
    diff --git generic/tclProc.c generic/tclProc.c
    index 642294cd8..1bd7361b1 100644
    --- generic/tclProc.c
    +++ generic/tclProc.c
    @@ -1428,7 +1428,7 @@ InitArgsAndLocals(
         numArgs = procPtr->numArgs;
         argCt = framePtr->objc - skip;	/* Set it to the number of args to the
     					 * procedure. */
    <span style="color:red">-    argObjs = framePtr->objv + skip;</span>
    <span style="color:green">+    argObjs = framePtr->objv ? framePtr->objv + skip : NULL;</span>
         if (numArgs == 0) {
     	if (argCt) {
     	    goto incorrectArgs;
    </pre>
    
  5. foundin changed to: "8.6.12"
  6. is_private changed to: "0"
  7. login: "chrstphrchvz"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "chrstphrchvz"
  13. subsystem changed to: "22. [proc] and [uplevel]"
  14. title changed to:
    pointer arithmetic using NULL in InitArgsAndLocals()
    
  15. type changed to: "Patch"