================
@@ -197,11 +176,64 @@ Error extractFromArchive(const Archive &Library,
return Error::success();
}
+bool isCompressed(const OffloadBinary::Header &Header) {
+ return Header.Version >= 3 && Header.InflatedSize != 0;
+}
+
+Expected<std::unique_ptr<MemoryBuffer>>
+decompressOffloadBinary(MemoryBufferRef Buf) {
+ const auto *Header =
+ reinterpret_cast<const OffloadBinary::Header *>(Buf.getBufferStart());
+ if (Header->EntriesOffset != sizeof(OffloadBinary::Header) ||
+ Header->EntriesOffset > Header->Size ||
+ Header->InflatedSize < Header->EntriesOffset)
----------------
sarnex wrote:
ah sorry, i missed that `InflatedSize` includes the size of the header, i
thought it was just the raw `OffloadingImage` size, makes sense, thanks
https://github.com/llvm/llvm-project/pull/222774
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits