summaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-06-10 19:12:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-06-10 19:12:52 +0000
commit97bc6c731eabb6212f094302b94f3f0f9534ebdf (patch)
tree471dda8f5419bb81beedeeef3b8975938d7e7340 /contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp
parent3adc74c768226112b373d0bcacee73521b0aed2a (diff)
parent85d8b2bbe386bcfe669575d05b61482d7be07e5d (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp')
-rw-r--r--contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp b/contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp
index cf6cd58f9533..ec531c3753ec 100644
--- a/contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp
+++ b/contrib/llvm/lib/ProfileData/CoverageMappingReader.cpp
@@ -19,6 +19,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/LEB128.h"
+#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -358,8 +359,12 @@ std::error_code readCoverageMappingData(
const char *CovBuf = Buf;
Buf += CoverageSize;
const char *CovEnd = Buf;
+
if (Buf > End)
return coveragemap_error::malformed;
+ // Each coverage map has an alignment of 8, so we need to adjust alignment
+ // before reading the next map.
+ Buf += alignmentAdjustment(Buf, 8);
while (FunBuf < FunEnd) {
// Read the function information