aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/XCOFFObjectFile.cpp
diff options
context:
space:
mode:
authorEsme-Yi <esme.yi@ibm.com>2021-09-13 07:54:33 +0000
committerEsme-Yi <esme.yi@ibm.com>2021-09-13 07:54:33 +0000
commitea81898d0fe2633fdef44822a8578924be4acd6c (patch)
tree6a136ff8c7294a80afb9dce28a33a7e12d5ae295 /llvm/lib/Object/XCOFFObjectFile.cpp
parent65ad09da0ea7b947ce4bfa96dee00a53230f4cf9 (diff)
downloadllvm-ea81898d0fe2633fdef44822a8578924be4acd6c.zip
llvm-ea81898d0fe2633fdef44822a8578924be4acd6c.tar.gz
llvm-ea81898d0fe2633fdef44822a8578924be4acd6c.tar.bz2
[XCOFF] Fix the program abortion issue in XCOFFObjectFile::getSectionContents.
Summary: Use std::move(E) to avoid `Program aborted due to an unhandled Error` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D109567
Diffstat (limited to 'llvm/lib/Object/XCOFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/XCOFFObjectFile.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp
index dfb48e6..dc9dcc0 100644
--- a/llvm/lib/Object/XCOFFObjectFile.cpp
+++ b/llvm/lib/Object/XCOFFObjectFile.cpp
@@ -295,8 +295,9 @@ XCOFFObjectFile::getSectionContents(DataRefImpl Sec) const {
const uint8_t * ContentStart = base() + OffsetToRaw;
uint64_t SectionSize = getSectionSize(Sec);
- if (checkOffset(Data, reinterpret_cast<uintptr_t>(ContentStart), SectionSize))
- return make_error<BinaryError>();
+ if (Error E = Binary::checkOffset(
+ Data, reinterpret_cast<uintptr_t>(ContentStart), SectionSize))
+ return std::move(E);
return makeArrayRef(ContentStart,SectionSize);
}