-
Notifications
You must be signed in to change notification settings - Fork 257
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
Add ZSTD decompression support #595
Add ZSTD decompression support #595
Conversation
universal/src/compression/zstd.cpp
Outdated
cur_pos += input.size; | ||
} | ||
|
||
ZSTD_freeDStream(stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use RAII for that to avoid resource leaks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
'В случае если content_encoding != "gzip" и content_encoding != "zstd" тело запроса потрётся :('
universal/src/compression/zstd.cpp
Outdated
} | ||
|
||
auto stream_del = [](ZSTD_DStream* ptr) { ZSTD_freeDStream(ptr); }; | ||
auto stream_guard = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like you can move up this guard to line after ZSTD_createDStream
also ZSTD_freeDStream accept NULL pointer
universal/src/compression/zstd.cpp
Outdated
throw TooBigError(); | ||
} | ||
if (decompressed_size > std::numeric_limits<int64_t>::max() / 2) { | ||
return DecompressStream(compressed, max_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you want to decompress more than 4611686018427387903 bytes?
seems like a sign mismatch here for <>
also decompressed_size is unsigned long long
Resolves issue #549
Benchmark results: