From 034a12e6361be524823d8701b66c3ca5c78e6243 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 22 Sep 2017 18:08:08 -0400 Subject: 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. --- src/lib/compression/compress_utils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/lib') 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& 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); -- cgit v1.2.3