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
parent f4cd545677
commit 74ff9ebf96

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)
}
}