imgproc(hdr): fix bounds check in HdrDecoder::checkSignature()

This commit is contained in:
Alexander Alekhin 2018-01-01 13:12:21 +00:00
parent 30373d2566
commit 4ca89db22d

View File

@ -102,8 +102,12 @@ bool HdrDecoder::readData(Mat& _img)
bool HdrDecoder::checkSignature( const String& signature ) const
{
if (signature.size() >= m_signature.size() &&
(!memcmp(signature.c_str(), m_signature.c_str(), m_signature.size()) ||
!memcmp(signature.c_str(), m_signature_alt.c_str(), m_signature_alt.size())))
0 == memcmp(signature.c_str(), m_signature.c_str(), m_signature.size())
)
return true;
if (signature.size() >= m_signature_alt.size() &&
0 == memcmp(signature.c_str(), m_signature_alt.c_str(), m_signature_alt.size())
)
return true;
return false;
}