From cb2b4498d2a0c8a15e2a66aa3c5f0d7ffa4cf058 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 13 May 2015 03:00:10 +0000 Subject: Add tests for compression and SRP. Fix zlib decompression which was not ignoring Z_BUF_ERROR which is harmless in this context as process is already checking avail_in and avail_out after run returns. Bump version to 1.11.17 --- src/lib/compression/compression.cpp | 3 +++ src/lib/compression/zlib/zlib.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib/compression') diff --git a/src/lib/compression/compression.cpp b/src/lib/compression/compression.cpp index 89d3a68e7..499fc1adf 100644 --- a/src/lib/compression/compression.cpp +++ b/src/lib/compression/compression.cpp @@ -128,16 +128,19 @@ void Stream_Compression::process(secure_vector& buf, size_t offset, u32bit void Stream_Compression::update(secure_vector& buf, size_t offset) { + BOTAN_ASSERT(m_stream, "Initialized"); process(buf, offset, m_stream->run_flag()); } void Stream_Compression::flush(secure_vector& buf, size_t offset) { + BOTAN_ASSERT(m_stream, "Initialized"); process(buf, offset, m_stream->flush_flag()); } void Stream_Compression::finish(secure_vector& buf, size_t offset) { + BOTAN_ASSERT(m_stream, "Initialized"); process(buf, offset, m_stream->finish_flag()); clear(); } diff --git a/src/lib/compression/zlib/zlib.cpp b/src/lib/compression/zlib/zlib.cpp index 415bbccac..a6a724754 100644 --- a/src/lib/compression/zlib/zlib.cpp +++ b/src/lib/compression/zlib/zlib.cpp @@ -67,8 +67,8 @@ class Zlib_Compression_Stream : public Zlib_Stream if(rc == Z_MEM_ERROR) throw std::bad_alloc(); - else if(rc != Z_OK && rc != Z_STREAM_END) - throw std::runtime_error("zlib deflate error"); + else if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) + throw std::runtime_error("zlib deflate error " + std::to_string(rc)); return (rc == Z_STREAM_END); } @@ -98,8 +98,8 @@ class Zlib_Decompression_Stream : public Zlib_Stream if(rc == Z_MEM_ERROR) throw std::bad_alloc(); - else if(rc != Z_OK && rc != Z_STREAM_END) - throw std::runtime_error("zlib deflate error"); + else if(rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) + throw std::runtime_error("zlib inflate error " + std::to_string(rc)); return (rc == Z_STREAM_END); } -- cgit v1.2.3