[Binary] Further improve malformed input handling for the OffloadBinary
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 24 Jun 2022 13:46:05 +0000 (09:46 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 24 Jun 2022 13:57:44 +0000 (09:57 -0400)
commit1dcbe03c32c197324e840717bb8dbf0b925ca433
tree96ffa437025fdd371b6eaa314eaaea7bb4686258
parentacc22aeb0fe1e34fe7236e233d9a2852f75fa9d8
[Binary] Further improve malformed input handling for the OffloadBinary

Summary:
This patch adds some new sanity checks to make sure that the sizes of
the offsets are within the bounds of the file or what is expected by the
binary. This also improves the error handling of the version structure
to be built into the binary itself so we can change it easier.
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
llvm/include/llvm/Object/OffloadBinary.h
llvm/lib/Object/OffloadBinary.cpp