From ea81898d0fe2633fdef44822a8578924be4acd6c Mon Sep 17 00:00:00 2001 From: Esme-Yi Date: Mon, 13 Sep 2021 07:54:33 +0000 Subject: [PATCH] [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 --- llvm/lib/Object/XCOFFObjectFile.cpp | 5 +++-- 1 file 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(ContentStart), SectionSize)) - return make_error(); + if (Error E = Binary::checkOffset( + Data, reinterpret_cast(ContentStart), SectionSize)) + return std::move(E); return makeArrayRef(ContentStart,SectionSize); } -- 2.7.4