[LLVMbugs] [Bug 5635] New: Bad handling of realpath

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Nov 29 00:30:58 PST 2009


           Summary: Bad handling of realpath
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: NetBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: System Library
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: neil at daikokuya.co.uk
                CC: llvmbugs at cs.uiuc.edu

System/Unix/Path.inc contains the following code:

  return Path(std::string(realpath(DLInfo.dli_fname, link_path)));

realpath can fail returning a NULL pointer, as clearly documented in the man
page, and clang then segfaults as it's constructing a std::string from a NULL

On my system (NetBSD) this happens when invoking clang through a symlink.

$ clang /tmp/bug.c
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Stack dump:
0.      Program arguments: clang /tmp/bug.c 
Abort trap

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