[llvm-bugs] [Bug 24684] New: InitPreprocessor.cpp:InitializePredefinedMacros constructs a version string from out-of-scope memory
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Sep 2 18:01:46 PDT 2015
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: unassignedclangbugs at nondot.org
Reporter: stefan.teleman at oracle.com
CC: llvm-bugs at lists.llvm.org
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150903/e91a9df5/attachment-0001.html>
More information about the llvm-bugs
mailing list