diff --git a/modules/highgui/src/loadsave.cpp b/modules/highgui/src/loadsave.cpp index 6658b1335..81c708acd 100644 --- a/modules/highgui/src/loadsave.cpp +++ b/modules/highgui/src/loadsave.cpp @@ -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++ )