Remove trailing zeroes from end of ptx (#390)

This commit is contained in:
Violet 2025-06-23 16:14:07 -07:00 committed by GitHub
commit 74ff9ebf96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,7 +142,7 @@ impl<'a> FatbinFile<'a> {
}
pub unsafe fn decompress(&'a self) -> Result<Vec<u8>, FatbinError> {
let payload = if self
let mut payload = if self
.header
.flags
.contains(FatbinFileHeaderFlags::CompressedLz4)
@ -158,6 +158,12 @@ impl<'a> FatbinFile<'a> {
unsafe { self.get_payload().to_vec() }
};
while payload.last() == Some(&0) {
// remove trailing zeros
payload.pop();
}
Ok(payload)
}
}