Skip to content

Commit

Permalink
[XCOFF] Fix the program abortion issue in XCOFFObjectFile::getSection…
Browse files Browse the repository at this point in the history
…Contents.

Summary: Use std::move(E) to avoid `Program aborted due to an unhandled Error`

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D109567
  • Loading branch information
EsmeYi committed Sep 13, 2021
1 parent 65ad09d commit ea81898
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/lib/Object/XCOFFObjectFile.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit ea81898

Please sign in to comment.