You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there! I've been running into this error quite a bit with some archives that my program interacts with, and I guess I'm not quite sure what to do about it? Here is an example file that seems to trigger it, and with the below code snippet, I get the "Unexpected data" message printed:
let mut f = BufReader::new(File::open("Packages.xz").unwrap());
let mut decomp: Vec<u8> = Vec::new();
match lzma_rs::xz_decompress(&mut f, &mut decomp) {
Ok(_) => {
println!("Everything was fine!");
true
},
Err(e) => if e.to_string().contains("Unexpected data after last XZ block") {
println!("Unexpected data after last XZ block!");
true
} else {
println!("Some other error! {}", e.to_string());
false
}
};
If I just choose to ignore the message (as I have been doing thus far) the decompress seems to otherwise be fine, the results fully readable, and life goes on. But I feel a little dirty about just throwing this message away, especially if it could actually be indicating an issue with the archive. If I use other utilities, however, they don't seem to have issues with it. For example:
So, with that in mind I tried a different route and provided the uncompressed size to the process directly:
let myopts = Options {
unpacked_size: UnpackedSize::UseProvided(Some(14263215)),
memlimit: None,
allow_incomplete: false,
};
match lzma_rs::lzma_decompress_with_options(&mut f, &mut decomp, &myopts) {
Ok(_) => {
println!("Everything was fine!");
true
},
Err(e) => if e.to_string().contains("Unexpected data after last XZ block") {
println!("Unexpected data after last XZ block!");
true
} else {
println!("Some other error! {}", e.to_string());
false
}
};
THIS results in the "Some other error" arm:
Some other error! lzma error: LZMA header invalid properties: 253 must be < 225
I feel like I'm on the right track here, but I'm just not sure what I'm missing to make this all "happy", so any suggestions/pointers/tips would be greatly appreciated! Thank you!
The text was updated successfully, but these errors were encountered:
I just tried with the lzma-rust crate, and that seems to work just fine with the archive. Maybe I'm running into the "subset of the .xz file format" limitation that is in the readme on this crate? Happy to be wrong on that, of course.
Hello there! I've been running into this error quite a bit with some archives that my program interacts with, and I guess I'm not quite sure what to do about it? Here is an example file that seems to trigger it, and with the below code snippet, I get the "Unexpected data" message printed:
If I just choose to ignore the message (as I have been doing thus far) the decompress seems to otherwise be fine, the results fully readable, and life goes on. But I feel a little dirty about just throwing this message away, especially if it could actually be indicating an issue with the archive. If I use other utilities, however, they don't seem to have issues with it. For example:
Digging a little bit more into this, I find that the headers do NOT include the sizes:
So, with that in mind I tried a different route and provided the uncompressed size to the process directly:
THIS results in the "Some other error" arm:
I feel like I'm on the right track here, but I'm just not sure what I'm missing to make this all "happy", so any suggestions/pointers/tips would be greatly appreciated! Thank you!
The text was updated successfully, but these errors were encountered: