aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression/compress_utils.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-22 18:08:08 -0400
committerJack Lloyd <[email protected]>2017-09-22 18:08:08 -0400
commit034a12e6361be524823d8701b66c3ca5c78e6243 (patch)
treebc22824fa4b079fc779a0ca47c9f02e3d5c507d1 /src/lib/compression/compress_utils.cpp
parent97cb5cd996e64f9979b5969457a7fe2bde073a64 (diff)
Improve compression tests slightly
Fix a bug that affected bzip2 - the bzip2 library does not like being called with avail_in == 0 and BZ_RUN, it returns PARAM_ERROR. Just return in that case and ignore the call.
Diffstat (limited to 'src/lib/compression/compress_utils.cpp')
-rw-r--r--src/lib/compression/compress_utils.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/compression/compress_utils.cpp b/src/lib/compression/compress_utils.cpp
index ceb180c4b..6edc22292 100644
--- a/src/lib/compression/compress_utils.cpp
+++ b/src/lib/compression/compress_utils.cpp
@@ -68,6 +68,12 @@ void Stream_Compression::process(secure_vector<uint8_t>& buf, size_t offset, uin
BOTAN_ASSERT(m_stream, "Initialized");
BOTAN_ASSERT(buf.size() >= offset, "Offset is sane");
+ // bzip doesn't like being called with no input and BZ_RUN
+ if(buf.size() == offset && flags == m_stream->run_flag())
+ {
+ return;
+ }
+
if(m_buffer.size() < buf.size() + offset)
m_buffer.resize(buf.size() + offset);