aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/compression
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/compression')
-rw-r--r--src/lib/compression/compression.cpp3
-rw-r--r--src/lib/compression/zlib/zlib.cpp8
2 files changed, 7 insertions, 4 deletions
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<byte>& buf, size_t offset, u32bit
void Stream_Compression::update(secure_vector<byte>& buf, size_t offset)
{
+ BOTAN_ASSERT(m_stream, "Initialized");
process(buf, offset, m_stream->run_flag());
}
void Stream_Compression::flush(secure_vector<byte>& buf, size_t offset)
{
+ BOTAN_ASSERT(m_stream, "Initialized");
process(buf, offset, m_stream->flush_flag());
}
void Stream_Compression::finish(secure_vector<byte>& 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);
}