aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-11-26 23:28:13 +0100
committerSimon Warta <[email protected]>2015-11-26 23:28:13 +0100
commit9b54e39d96b3d586cb3a790ddc9a9610b25a07bf (patch)
tree32724bd03797947b015a26127734095d23be5726 /src/lib
parent07e18a8a4f6bc07c51be527ec47df324330ec6fa (diff)
parent73c879526f327d77138482c9bd1129060afcfca9 (diff)
Merge pull request #320 from matejk/fix_crash_in_comp_filter
Fixed crash in compression filter when transform argument is null.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/filters/comp_filter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/filters/comp_filter.cpp b/src/lib/filters/comp_filter.cpp
index 61ac16f38..f909db4a7 100644
--- a/src/lib/filters/comp_filter.cpp
+++ b/src/lib/filters/comp_filter.cpp
@@ -1,6 +1,7 @@
/*
* Filter interface for compression
* (C) 2014,2015 Jack Lloyd
+* (C) 2015 Matej Kenda
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -23,9 +24,15 @@ Decompression_Filter::Decompression_Filter(const std::string& type, 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)
{
+ if (!transform)
+ {
+ throw std::invalid_argument("Transform is null");
+ }
m_transform.reset(dynamic_cast<Compressor_Transform*>(transform));
if(!m_transform)
+ {
throw std::invalid_argument("Transform " + transform->name() + " is not a compressor");
+ }
}
std::string Compression_Decompression_Filter::name() const