summaryrefslogtreecommitdiff
path: root/lib/profile/InstrProfiling.c
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-02-23 20:46:14 +0000
committerVedant Kumar <vsk@apple.com>2016-02-23 20:46:14 +0000
commit0f6bf7c5dd33135f79f9617ea5d12f57afab93be (patch)
tree764144d573ab170a2a251aa5fad2a8b688a34ea5 /lib/profile/InstrProfiling.c
parent7a7e73018444e8be9536e498f39f78aa38aa61e0 (diff)
[profile] Fix iteration over profile data entries
Fix a crash when gathering value profile data on i386 Darwin. The Darwin linker shrinks sections containing aligned structures when padding is not explicitly added to the end of the structure. When iterating over these structures, be sure to not walk past the end of the section. No tests added, since running `ninja check-profile` on i386 Darwin is enough to reproduce the original crash. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfiling.c')
-rw-r--r--lib/profile/InstrProfiling.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/profile/InstrProfiling.c b/lib/profile/InstrProfiling.c
index 711f2b608..24820ec6d 100644
--- a/lib/profile/InstrProfiling.c
+++ b/lib/profile/InstrProfiling.c
@@ -46,7 +46,7 @@ COMPILER_RT_VISIBILITY void __llvm_profile_reset_counters(void) {
const __llvm_profile_data *DataBegin = __llvm_profile_begin_data();
const __llvm_profile_data *DataEnd = __llvm_profile_end_data();
const __llvm_profile_data *DI;
- for (DI = DataBegin; DI != DataEnd; ++DI) {
+ for (DI = DataBegin; DI < DataEnd; ++DI) {
uint64_t CurrentVSiteCount = 0;
uint32_t VKI, i;
if (!DI->Values)