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

ZSTD : Drive the end of decompression with both "inputLimit" and "outputLimit" #197

Open
nephri opened this issue May 4, 2024 · 0 comments

Comments

@nephri
Copy link

nephri commented May 4, 2024

Hi,
I have an input ByteBuffer with some datas i want to decompress.

I know i can decompress 65536 bytes but i don't know how many bytes in input buffer will be needed for this (but i know my input buffer contains enough data to achieve it and can decompress exactly 64K bytes)

So, i call ZstdDecompressor.decompress( ByteBufffer input , ByteBuffer output )
With exactly 65536 bytes availables to output

This method call io.airlift.compress.MalformedInputException: Output buffer too small: offset=999 because it try to decompress more than 65536 bytes.

It's because after a frame, it reach 65536 output bytes but continue because input bytes are remaining

In ZstdFrameDecompressor i would have a code like this:

150: while( input < inputLimit && output < outputLimit ) {

But also in ZstdDecompressor (like line 101), we should update position on output buffer and also on input buffer

If the outputlimit is not perfectly aligned with a frame, we should continue to have the MalformedInputException

Best regards,
Sébastien.

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

1 participant