Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lzma data error (again) #75

Open
Yuri6037 opened this issue Feb 10, 2021 · 2 comments
Open

Lzma data error (again) #75

Yuri6037 opened this issue Feb 10, 2021 · 2 comments

Comments

@Yuri6037
Copy link

Yuri6037 commented Feb 10, 2021

I'm back with the same error as before but this time with a bit more information:

  • First the code is still valid and what I said last time about the buffer size, does NOT fix the problem it HIDES the problem.
  • From the look of it the problem is with process_vec. The online C example of XZ does not have this defect.
  • I identfied a way to reproduce the bug: if you must call process_vec more than 3 times in the same Run action you crash it. The next time you call it with more data will be returned with the great "lzma data error".
  • This means that if you manage to find a large enough output buffer size (with_capacity) for process_vec to use and return the entire decompressed data in exatcly 3 calls, where the first returns the data the second returns 0 and the thrid returns MemNeeded, then the software will continue on the next buffer of compressed data.
  • If the exact pattern stated previously is not respected (for example the output vec is not large enough) then your software will inevitably crash at the next buffer.

Why is that? Is there a way to prevent that issue?

@alexcrichton
Copy link
Owner

Sorry I probably won't be able to help much here. I only lightly maintain this nowadays and the intention was to be very close to the C API so if there's issues it's likely with the C implementation rather than the Rust bindings (in theory). I don't have the time right now to dig in further though.

@Yuri6037
Copy link
Author

As I said it's not happening with the C API. It only occurs with your wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants