mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Fix a potential bug of ParallelLoopBodyWrapper::operator(Range)
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). This bug is found when running OpenCV's Retina tutorial on 32bit VS2010.
This commit is contained in:
parent
7b95bb20f7
commit
2519a21935
@ -144,9 +144,9 @@ namespace
|
||||
{
|
||||
cv::Range r;
|
||||
r.start = (int)(wholeRange.start +
|
||||
((size_t)sr.start*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
|
||||
((uint64)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);
|
||||
((uint64)sr.end*(wholeRange.end - wholeRange.start) + nstripes/2)/nstripes);
|
||||
(*body)(r);
|
||||
}
|
||||
cv::Range stripeRange() const { return cv::Range(0, nstripes); }
|
||||
|
Loading…
Reference in New Issue
Block a user