llvm-project
d2d80787 - [OffloadBundler] Bound compressed bundles by header size, not magic scan (#205587)

Commit
78 days ago
[OffloadBundler] Bound compressed bundles by header size, not magic scan (#205587) The compressed offload bundle (CCOB) readers located the boundary between concatenated bundles by scanning for the literal 4-byte magic "CCOB". Those bytes can appear by chance inside a compressed payload, so a single valid bundle could be truncated at the spurious magic and then fail to decompress with "Src size is incorrect". At runtime this surfaced as hipErrorInvalidImage ("device kernel image is invalid") when loading affected HIP code objects. Use the authoritative FileSize recorded in the compressed bundle header (CompressedBundleHeader::tryParse, present for V2/V3) to delimit the current bundle, and search for the next bundle's "CCOB" magic only past that point. This keeps multi-bundle iteration working (and tolerant of inter-bundle padding) while ignoring magic-byte collisions inside the payload. Bundles without a recorded size (legacy V1) fall back to the previous magic scan.
Parents
Loading