[LLVMbugs] [Bug 7879] New: null pointer error when empty StringRef is converted to std::string

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 12 16:55:10 PDT 2010


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

           Summary: null pointer error when empty StringRef is converted
                    to std::string
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jim at thegoodnows.net
                CC: llvmbugs at cs.uiuc.edu


When an empty StringRef is constructed, the Data pointer is set to 0 and the
length is set to 0. When that StringRef is converted to a std::string, the 0 is
passed to the std::string constructor and the MS STL debug library checks the
pointer before checking the length and gives a NULL pointer assertion error.

This occurs in Clang in Preprocessor::Preprocessor on the line:

PragmaHandlers = new PragmaNamespace(llvm::StringRef());

where PragmaNamespace wants a std::string as it's initializer.

-- 
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