llvm.org GIT mirror llvm / ddd4585
[Object] Return an error code instead of asserting This makes it easier to report errors up the stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271140 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 3 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
949949 std::error_code
950950 COFFObjectFile::getSectionContents(const coff_section *Sec,
951951 ArrayRef &Res) const {
952 // PointerToRawData and SizeOfRawData won't make sense for BSS sections,
953 // don't do anything interesting for them.
954 assert((Sec->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA) == 0 &&
955 "BSS sections don't have contents!");
952 // In COFF, a virtual section won't have any in-file
953 // content, so the file pointer to the content will be zero.
954 if (Sec->PointerToRawData == 0)
955 return object_error::parse_failed;
956956 // The only thing that we need to verify is that the contents is contained
957957 // within the file bounds. We don't need to make sure it doesn't cover other
958958 // data, as there's nothing that says that is not allowed.