Fix a potential bug of ParallelLoopBodyWrapper::operator(Range) on 32-bit (Bugfix #3233)
Description
void operator()(const cv::Range& sr) const { cv::Range r; r.start = (int)(wholeRange.start + ((size_t)sr.start*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes); r.end = sr.end >= nstripes ? wholeRange.end : (int)(wholeRange.start + ((size_t)sr.end*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes); (*body)(r); }
On a 32-bit compiler the calculation may result in data (size_t) overflow when running some paralleled algorithms (which can safely run on a 64-bit compiler), resulting range is shaped to undefined values.
This bug is found when running OpenCV's Retina tutorial on 32bit VS2010.
Bugfix is sent:
https://github.com/Itseez/opencv/pull/1332
Associated revisions
Merge pull request #3233 from niebles:master