https://llvm.org/bugs/show_bug.cgi?id=24684

            Bug ID: 24684
           Summary: InitPreprocessor.cpp:InitializePredefinedMacros
                    constructs a version string from out-of-scope memory
           Product: clang
           Version: 3.6
          Hardware: Sun
                OS: Solaris
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

This is a placeholder bug for a patch I will be submitting very shortly.

In file ${top_srcdir}/tools/clang/lib/Frontend/InitPreprocessor.cpp,
static function InitializePredefinedMacros() does the following, at
line 472:

Builder.defineMacro("__clang_version__", 
                      "\"" CLANG_VERSION_STRING " "
                      + getClangFullRepositoryVersion() + "\"");

The second llvm::Twine argument to MacroBuilder::defineMacro is
constructed from a concatenation of string literals plus the return
value of getClangFullRepositoryVersion(), which is a std::string.

This std::string goes out-of-scope, and the resulting clang version string
contains invalid memory. This shows up in Valgrind on Linux, and causes
SEGV on Solaris SPARC.

Follow-up patch very shortly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to