Merge pull request #17352 from egorpugin:patch-2
* Fix integer overflow in parseOption(). Previous code does not work for values like 100000MB. * Fix warning during 32-bit build on inactive code path. * fix build without C++11
This commit is contained in:
parent
29bbbaa0a7
commit
1bec7ca540
@ -1961,7 +1961,11 @@ inline size_t parseOption(const std::string &value)
|
||||
}
|
||||
cv::String valueStr = value.substr(0, pos);
|
||||
cv::String suffixStr = value.substr(pos, value.length() - pos);
|
||||
int v = atoi(valueStr.c_str());
|
||||
#ifdef CV_CXX11
|
||||
size_t v = (size_t)std::stoull(valueStr);
|
||||
#else
|
||||
size_t v = (size_t)atol(valueStr.c_str());
|
||||
#endif
|
||||
if (suffixStr.length() == 0)
|
||||
return v;
|
||||
else if (suffixStr == "MB" || suffixStr == "Mb" || suffixStr == "mb")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user