diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-21 20:42:37 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-03-21 20:42:37 +0000 |
commit | 813d0a276112d79ba13a2cab9f785d1f18e6193d (patch) | |
tree | ea717f50d294579df27eca17f00063bd77639c1f | |
parent | bc2740a5981161bec9d81be36cb135428cb26b6d (diff) | |
download | llvm-813d0a276112d79ba13a2cab9f785d1f18e6193d.tar.gz llvm-813d0a276112d79ba13a2cab9f785d1f18e6193d.tar.bz2 llvm-813d0a276112d79ba13a2cab9f785d1f18e6193d.tar.xz |
InstrProf: Change magic number to have non-text characters
Include non-text characters in the magic number so that text files can't
match.
<rdar://problem/15950346>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204513 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/ProfileData/InstrProfReader.cpp | 16 | ||||
-rw-r--r-- | test/tools/llvm-profdata/Inputs/binary.profdata | bin | 1384 -> 1384 bytes | |||
-rw-r--r-- | test/tools/llvm-profdata/raw-magic-but-no-header.test | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index a95d9bc3b0..f923ad2ddd 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -90,14 +90,14 @@ RawInstrProfReader::RawInstrProfReader(std::unique_ptr<MemoryBuffer> DataBuffer) static uint64_t getRawMagic() { return - uint64_t('l') << 56 | - uint64_t('p') << 48 | - uint64_t('r') << 40 | - uint64_t('o') << 32 | - uint64_t('f') << 24 | - uint64_t('r') << 16 | - uint64_t('a') << 8 | - uint64_t('w'); + uint64_t(255) << 56 | + uint64_t('l') << 48 | + uint64_t('p') << 40 | + uint64_t('r') << 32 | + uint64_t('o') << 24 | + uint64_t('f') << 16 | + uint64_t('r') << 8 | + uint64_t(129); } bool RawInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) { diff --git a/test/tools/llvm-profdata/Inputs/binary.profdata b/test/tools/llvm-profdata/Inputs/binary.profdata Binary files differindex 156c483d15..e8cef21de5 100644 --- a/test/tools/llvm-profdata/Inputs/binary.profdata +++ b/test/tools/llvm-profdata/Inputs/binary.profdata diff --git a/test/tools/llvm-profdata/raw-magic-but-no-header.test b/test/tools/llvm-profdata/raw-magic-but-no-header.test index e899ece275..6db723c3e2 100644 --- a/test/tools/llvm-profdata/raw-magic-but-no-header.test +++ b/test/tools/llvm-profdata/raw-magic-but-no-header.test @@ -1,6 +1,6 @@ -RUN: printf "warforpl" > %t +RUN: printf '\201rforpl\377' > %t RUN: not llvm-profdata show %t 2>&1 | FileCheck %s -RUN: printf "lprofraw" > %t +RUN: printf '\377lprofr\201' > %t RUN: not llvm-profdata show %t 2>&1 | FileCheck %s CHECK: error: {{.+}}: Invalid header |