https://llvm.org/bugs/show_bug.cgi?id=27714
Bug ID: 27714 Summary: clang trunk r261461+ fails to compile on some platforms (including Snow Leopard) due to strnlen usage Product: clang Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: jerem...@apple.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified strnlen() is used unconditionally, but it is not available on all supported platforms. trunk/tools/clang/lib/Lex/HeaderMap.cpp:158:18: error: use of undeclared identifier 'strnlen' unsigned Len = strnlen(Data, MaxLen); ^ 1 error generated. --- Regression introduced by: commit 839cd13b65d802f06276ff88d234419c38a44199 Author: Duncan P. N. Exon Smith <dexonsm...@apple.com> Date: Sun Feb 21 00:14:36 2016 +0000 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261461 91177308-0d34-0410-b5e6-96231b3b80d8 -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs