summaryrefslogtreecommitdiff
path: root/include/llvm/Support/GCOV.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/GCOV.h')
-rw-r--r--include/llvm/Support/GCOV.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h
index 469a9e3ef9..0aa716aac0 100644
--- a/include/llvm/Support/GCOV.h
+++ b/include/llvm/Support/GCOV.h
@@ -152,11 +152,11 @@ public:
}
bool readInt(uint32_t &Val) {
- StringRef Str = Buffer->getBuffer().slice(Cursor, Cursor+4);
- if (Str.empty()) {
+ if (Buffer->getBuffer().size() < Cursor+4) {
errs() << "Unexpected end of memory buffer: " << Cursor+4 << ".\n";
return false;
}
+ StringRef Str = Buffer->getBuffer().slice(Cursor, Cursor+4);
Cursor += 4;
Val = *(const uint32_t *)(Str.data());
return true;