Skip to content
Tcl Source Code History Of Ticket adb198c256
Login

History Of Ticket adb198c256

Artifacts Associated With Ticket adb198c256

  1. Ticket change [e09d42bf22] (rid 154856) by chw on 2017-07-02 05:03:00:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      I think there are two potential Tcl_Obj leaks in the current version
      of tclPathObj.c in the TclJoinPath function, as shown in the following
      patch.
      
      The first in a newly introduced code path which releases a Tcl_Obj
      although it gets used later, the second regarding the path name
      separator returned as an optional new Tcl_Obj from a VFS implementation
      which never gets released.
      
      Index: generic/tclPathObj.c
      ==================================================================
      --- generic/tclPathObj.c
      +++ generic/tclPathObj.c
      @@ -916,22 +916,27 @@
       		     * cannot have backslashes either.
       		     */
       
       		    if ((tclPlatform != TCL_PLATFORM_WINDOWS)
       			    || (strchr(Tcl_GetString(elt), '\\') == NULL)) {
      -			if (res != NULL) {
      -			    TclDecrRefCount(res);
      -			}
      -
       			if (PATHFLAGS(elt)) {
      +			    if (res != NULL) {
      +				TclDecrRefCount(res);
      +			    }
       			    return TclNewFSPathObj(elt, str, len);
       			}
       			if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) {
      +			    if (res != NULL) {
      +				TclDecrRefCount(res);
      +			    }
       			    return TclNewFSPathObj(elt, str, len);
       			}
       			(void) Tcl_FSGetNormalizedPath(NULL, elt);
       			if (elt == PATHOBJ(elt)->normPathPtr) {
      +			    if (res != NULL) {
      +				TclDecrRefCount(res);
      +			    }
       			    return TclNewFSPathObj(elt, str, len);
       			}
       		    }
       		}
       
      @@ -1085,10 +1090,11 @@
       	    if (fsPtr->filesystemSeparatorProc != NULL) {
       		Tcl_Obj *sep = fsPtr->filesystemSeparatorProc(res);
       
       		if (sep != NULL) {
       		    separator = TclGetString(sep)[0];
      +		    Tcl_DecrRefCount(sep);
       		}
       		/* Safety check in case the VFS driver caused sharing */
       		if (Tcl_IsShared(res)) {
       		    TclDecrRefCount(res);
       		    res = Tcl_DuplicateObj(res);
      
      ==================================================================
      
    5. foundin initialized to: "current"
    6. is_private initialized to: "0"
    7. login: "chw"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0b3aff16612e1e9f3b675963fa64e01bd1d89307"
    10. resolution initialized to: "None"
    11. severity initialized to: "Critical"
    12. status initialized to: "Open"
    13. submitter initialized to: "chw"
    14. subsystem initialized to: "36. Pathname Management"
    15. title initialized to: "Potential Tcl_Obj leak in tclPathObj.c"
    16. type initialized to: "Bug"
  2. Ticket change [b87c161f29] (rid 154871) by sebres on 2017-07-03 09:25:46:

    1. closedate changed to: "2457937.89289918"
    2. closer changed to: "sebres"
    3. icomment:
      Fixed for 8.6 and 8.5.
      Thanks.
      
    4. login: "sebres"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  3. Ticket change [5ea92d6766] (rid 155099) by dgp on 2017-07-06 12:35:09:

    1. closedate changed to: "2457941.02442013"
    2. closer changed to: "dgp"
    3. icomment:
      
      Any test cases?
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  4. Ticket change [5572923f2f] (rid 155100) by dgp on 2017-07-06 14:08:26:

    1. closedate changed to: "2457941.08919503"
    2. icomment:
      
      Still looking, but it appears this is tidying
      up some code that cannot actually ever be reached.
      
      I think we'd be better eliminating it.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  5. Ticket change [d36648d494] (rid 155101) by dgp on 2017-07-06 14:14:56:

    1. closedate changed to: "2457941.09370936"
    2. icomment:
      
      This large conditional block
      
      https://core.tcl.tk/tcl/artifact/6c6428a1c565405c?ln=877-960
      
      is conditioned on (i == 0) among others.
      
      That means we can only execute this block on
      the first iteration of the for loop, and at
      that point, nothing has had the chance to make
      res contain anything other than NULL.  Much
      code directing what to do when (res != NULL)
      is actually useless.  Some asserts would be better,
      I think.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  6. Ticket change [463995cb42] (rid 155102) by sebres on 2017-07-06 14:56:39:

    1. closedate changed to: "2457941.1226824"
    2. closer changed to: "sebres"
    3. icomment:
      > That means we can only execute this block on the first iteration of the for loop
      
      Hmm, strange... The question is "Why this belong then to the cycle, and not above it?"
      I fixed it just by the way like "minimalistic" surgery, so don't observed the cycle conditions.
      
    4. login: "sebres"
    5. mimetype: "text/plain"
  7. Ticket change [d0d9044cd8] (rid 155103) by dgp on 2017-07-06 15:25:36:

    1. closedate changed to: "2457941.14278435"
    2. closer changed to: "dgp"
    3. icomment:
      
      I think that would be a further improvement.
      Will look into it.
      
      The code is messy, fragile, and abandoned
      by the originator, so it improves only in
      tiny, tentative incremental changes, usually
      motivated by actual bugs and crashes, not
      just aesthetic concerns.
      
      Someone who really got up a head of steam
      to make it much much better would be better
      off rewriting the thing from the ground up,
      IMO.
      
      That said, the memleak in the separator
      handling from a VFS looks legit and 
      properly fixed.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  8. Ticket change [1e4e82b495] (rid 155104) by dgp on 2017-07-06 15:28:37:

    1. closedate changed to: "2457941.14488277"
    2. icomment:
      
      Having said that, it's worth noting that the
      codebases of the 8.5 and 8.6 filesystem implementations
      have diverged, and I lack much confidence that
      a patch developed for one can lightly be applied
      to the other.
      
      I'd be happier leaving 8.5 untouched, and if that
      leaves unfixed bugs, then the fix for them is to
      start using 8.6.
      
    3. login: "dgp"
    4. mimetype: "text/plain"
  9. Ticket change [ae6e357407] (rid 155111) by dgp on 2017-07-06 16:35:32:

    1. closedate changed to: "2457941.19134904"
    2. icomment:
      
      Revised the fix on the 8.6 branch; will merge fwd.
      
    3. login: "dgp"
    4. mimetype: "text/plain"