mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 14:06:27 +08:00
Imgcodecs: Fixed a bug with checkSignature in GdalDecoder
In cases where the signaure string contains a terminating character, the std::string member function size returns a smaller value than the allocated string. In these cases, if you then try to use substr, you will get an out_of_range exception. This patch remedies the problem.
This commit is contained in:
parent
6172803012
commit
4e513a3346
@ -559,7 +559,7 @@ bool GdalDecoder::checkSignature( const String& signature )const{
|
||||
|
||||
|
||||
// look for NITF
|
||||
std::string str = signature.c_str();
|
||||
std::string str(signature);
|
||||
if( str.substr(0,4).find("NITF") != std::string::npos ){
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user