summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PTHLexer.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-08-17 03:55:43 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-08-17 03:55:43 +0000
commit2683b4c0fdbd3c1e2320dd0ce8810f313dafe197 (patch)
tree5b084565d530d83564b3919d3283ed9a2e610bee /clang/lib/Lex/PTHLexer.cpp
parent2fe6aab7881fb7701bd8ed45428e9748419585a5 (diff)
downloadbcm5719-llvm-2683b4c0fdbd3c1e2320dd0ce8810f313dafe197.tar.gz
bcm5719-llvm-2683b4c0fdbd3c1e2320dd0ce8810f313dafe197.zip
Switch PTH format from a 7 byte magic number to an 8 byte one, to avoid
misaligned reads throughout the file. Bump PTH format version to 10. llvm-svn: 162076
Diffstat (limited to 'clang/lib/Lex/PTHLexer.cpp')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index f104f967083..67738e90751 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/lib/Lex/PTHLexer.cpp
@@ -452,14 +452,14 @@ PTHManager *PTHManager::Create(const std::string &file,
const unsigned char *BufEnd = (unsigned char*)File->getBufferEnd();
// Check the prologue of the file.
- if ((BufEnd - BufBeg) < (signed)(sizeof("cfe-pth") + 3 + 4) ||
- memcmp(BufBeg, "cfe-pth", sizeof("cfe-pth") - 1) != 0) {
+ if ((BufEnd - BufBeg) < (signed)(sizeof("cfe-pth") + 4 + 4) ||
+ memcmp(BufBeg, "cfe-pth", sizeof("cfe-pth")) != 0) {
Diags.Report(diag::err_invalid_pth_file) << file;
return 0;
}
// Read the PTH version.
- const unsigned char *p = BufBeg + (sizeof("cfe-pth") - 1);
+ const unsigned char *p = BufBeg + (sizeof("cfe-pth"));
unsigned Version = ReadLE32(p);
if (Version < PTHManager::Version) {
OpenPOWER on IntegriCloud