diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-21 00:14:36 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-02-21 00:14:36 +0000 |
commit | 96a01fa04671d7c554007d256294f4ddd96d3eee (patch) | |
tree | 866023e74213cde3ce35aef41cf94a21222803f6 /llvm/lib/Target/TargetLoweringObjectFile.cpp | |
parent | 471efd244a7f970948cb0d189ec41d1840e9607b (diff) | |
download | bcm5719-llvm-96a01fa04671d7c554007d256294f4ddd96d3eee.tar.gz bcm5719-llvm-96a01fa04671d7c554007d256294f4ddd96d3eee.zip |
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
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions