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

Snappy decompression will fail on certain sequence of bytes. #88

Closed
ak88 opened this issue Jan 14, 2024 · 2 comments · Fixed by #89
Closed

Snappy decompression will fail on certain sequence of bytes. #88

ak88 opened this issue Jan 14, 2024 · 2 comments · Fixed by #89

Comments

@ak88
Copy link
Contributor

ak88 commented Jan 14, 2024

Using a certain sequence of bytes decompression will fail with System.IO.InvalidDataException: 'Invalid copy offset'

I have made a PR demonstrating this here:
#87

brantburnett pushed a commit that referenced this issue Jan 14, 2024
Motivation
----------
In cases where the stream decompression block read hits with a start
point within the middle of a tag but then the literal is longer than the
entire block available we are incorrectly handling the _lookbackPosition
when we return.

Modifications
-------------
Refactor the handling to be a bit less confusing and correct the
result. Add a test for the failure case.

Fixes #88
@brantburnett
Copy link
Owner

Thanks for the repro, I believe I have the fix figured out. For general reference, the problem was specific to stream decompression with very long literal segments. Block decompression should have been unaffected.

@ak88
Copy link
Contributor Author

ak88 commented Jan 14, 2024

Thanks for the repro, I believe I have the fix figured out. For general reference, the problem was specific to stream decompression with very long literal segments. Block decompression should have been unaffected.

Awesome! Thanks for the quick reaction.

brantburnett added a commit that referenced this issue Jan 15, 2024
Motivation
----------
In cases where the stream decompression block read hits with a start
point within the middle of a tag but then the literal is longer than the
entire block available we are incorrectly handling the _lookbackPosition
when we return.

Modifications
-------------
Refactor the handling to be a bit less confusing and correct the result.
Add a test for the failure case.

Fixes #88
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

Successfully merging a pull request may close this issue.

2 participants