[LLVMbugs] [Bug 11967] New: Path::isValid breaks when path has trailing slash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 9 21:52:54 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11967

             Bug #: 11967
           Summary: Path::isValid breaks when path has trailing slash
           Product: libraries
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: System Library
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sschiffli at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


This is called close to the beginning of the function:
  // This code assumes that path is null terminated, so make sure it is.
  ScopedNullTerminator snt(path);

Then if the path has a trailing slash this code is executed:
  // Remove trailing slash, unless it's a root slash.
  if (len > rootslash+1 && path[len-1] == '/')
    path.erase(--len);

The problem is the path.erase removes both the slash and the null terminator. 
This leads to the destructor of ScopedNullTerminator to assert.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list