Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Fix possible decompression error in zstd::istreambuf #146

Merged
merged 1 commit into from
May 23, 2017

Conversation

jgehring
Copy link
Member

It's possible that the Zstd stream will not decompress any data but still asks
for more. I observed this in one instance in which Zstd would return '1' as a
hint for the size of the next chunk of input data, but when fed with a single
byte would not decompress anything. The previous implementation would ignore
this and pass the same pointer for all three arguments of setg(). This may cause
a segmentation fault or various other problems down the road (depending on
compiler and optimization level).

It's possible that the Zstd stream will not decompress any data but still asks
for more. I observed this in one instance in which Zstd would return '1' as a
hint for the size of the next chunk of input data, but when fed with a single
byte would not decompress anything. The previous implementation would ignore
this and pass the same pointer for all three arguments of setg(). This may cause
a segmentation fault or various other problems down the road (depending on
compiler and optimization level).
@jgehring
Copy link
Member Author

Here's some test data that will produce a segfault without this fix: https://www.dropbox.com/s/4lo1brqsiim60e1/testdata.zstd?dl=0. Now, zstd -d and this stream implementation will yield the same output.

@jgehring jgehring merged commit b5e023f into TorchCraft:develop May 23, 2017
@jgehring jgehring deleted the zstdistreambuf-fix branch May 30, 2017 14:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants