Commit 5c8cd768 authored by Alexander Alekhin's avatar Alexander Alekhin

fix bug with invalid signature size (should not be less than signatureLength())

parent 3a8af7d6
......@@ -137,9 +137,9 @@ static ImageDecoder findDecoder( const Mat& buf )
maxlen = std::max(maxlen, len);
}
string signature(maxlen, ' ');
size_t bufSize = buf.rows*buf.cols*buf.elemSize();
maxlen = std::min(maxlen, bufSize);
string signature(maxlen, ' ');
memcpy( &signature[0], buf.data, maxlen );
for( i = 0; i < codecs.decoders.size(); i++ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment