aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/filters/comp_filter.cpp6
-rw-r--r--src/lib/filters/comp_filter.h1
2 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/filters/comp_filter.cpp b/src/lib/filters/comp_filter.cpp
index 76c90d626..61ac16f38 100644
--- a/src/lib/filters/comp_filter.cpp
+++ b/src/lib/filters/comp_filter.cpp
@@ -20,9 +20,9 @@ Decompression_Filter::Decompression_Filter(const std::string& type, size_t bs) :
{
}
-Compression_Decompression_Filter::Compression_Decompression_Filter(Transform* transform, size_t bs)
+Compression_Decompression_Filter::Compression_Decompression_Filter(Transform* transform, size_t bs) :
+ m_buffersize(std::max<size_t>(256, bs)), m_buffer(m_buffersize)
{
- m_buffer.resize(std::min<size_t>(256, bs));
m_transform.reset(dynamic_cast<Compressor_Transform*>(transform));
if(!m_transform)
throw std::invalid_argument("Transform " + transform->name() + " is not a compressor");
@@ -42,7 +42,7 @@ void Compression_Decompression_Filter::write(const byte input[], size_t input_le
{
while(input_length)
{
- const size_t take = std::min(m_buffer.size(), input_length);
+ const size_t take = std::min(m_buffersize, input_length);
BOTAN_ASSERT(take > 0, "Consumed something");
m_buffer.assign(input, input + take);
diff --git a/src/lib/filters/comp_filter.h b/src/lib/filters/comp_filter.h
index 503f25102..59d6f7185 100644
--- a/src/lib/filters/comp_filter.h
+++ b/src/lib/filters/comp_filter.h
@@ -33,6 +33,7 @@ class BOTAN_DLL Compression_Decompression_Filter : public Filter
void flush();
private:
std::unique_ptr<Compressor_Transform> m_transform;
+ std::size_t m_buffersize;
secure_vector<byte> m_buffer;
};