llvm-project/clang
Duncan P. N. Exon Smith 96a01fa046 Lex: Never overflow the file in HeaderMap::lookupFilename()
If a header map file is corrupt, the strings in the string table may not
be null-terminated.  The logic here previously relied on `MemoryBuffer`
always being null-terminated, but this isn't actually guaranteed by the
class AFAICT.  Moreover, we're seeing a lot of crash traces at calls to
`strlen()` inside of `lookupFilename()`, so something is going wrong
there.

Instead, use `strnlen()` to get the length, and check for corruption.

Also remove code paths that could call `StringRef(nullptr)`.  r261459
made these rather obvious (although they'd been there all along).

llvm-svn: 261461
2016-02-21 00:14:36 +00:00
..
INPUTS
bindings libclang: expose dllexport, dllimport attributes 2015-12-10 18:45:18 +00:00
cmake Add call to find_package to load LLVM dependencies 2016-02-19 00:56:56 +00:00
docs Add an AST matcher for real floating-point types. e.g., float, double, long double, but not complex. 2016-02-18 16:36:01 +00:00
examples Revert r260265, "clang-cl: Support loading plugins on Windows" 2016-02-11 16:33:20 +00:00
include Lex: Change HeaderMapImpl::getString() to return StringRef, NFC 2016-02-20 23:12:51 +00:00
lib Lex: Never overflow the file in HeaderMap::lookupFilename() 2016-02-21 00:14:36 +00:00
runtime Remove autoconf support 2016-01-26 21:30:40 +00:00
test [MSVC Compat] Add support for /GX, /GX- 2016-02-20 09:23:44 +00:00
tools [c-index-test] CMake: When installing c-index-test to a different prefix directory, add an rpath so that 2016-02-20 20:34:55 +00:00
unittests Lex: Never overflow the file in HeaderMap::lookupFilename() 2016-02-21 00:14:36 +00:00
utils [cmake] Revert r260742 (and r260744) to improve order file support. 2016-02-17 02:13:35 +00:00
www Implement the likely resolution of core issue 253. 2016-02-19 01:52:46 +00:00
.arcconfig Revert r242365. 2015-07-16 00:32:26 +00:00
.clang-format
.clang-tidy
.gitignore Add the clang debug info test directory to .gitignore as it's managed separately. 2016-01-29 01:35:55 +00:00
CMakeLists.txt [cmake] Revert r260742 (and r260744) to improve order file support. 2016-02-17 02:13:35 +00:00
CODE_OWNERS.TXT Added Anastasia Stulova as a code owner for OpenCL 2016-02-03 18:51:19 +00:00
INSTALL.txt Honor system specific paths of MAN pages 2015-11-20 18:49:02 +00:00
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt Update mailing list references to lists.llvm.org 2015-08-05 03:55:23 +00:00

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/