minMaxIdx() seems to clobber stack (Bug #1327)
Description
When looping over rows in a Mat, and calling minMaxIdx() on the row, the loop counter gets clobbered, causing an infinite loop. See the attached source to reproduce.
Running on Ubuntu 9.04.3 x64, gcc version 4.4.3.
PS: I suspect this may actually be a GCC bug, but that's much less likely than it being a bug with minMaxIdx().
Associated revisions
Merge pull request #1327 from alalek:ocl_master_tests_fix
History
Updated by Vadim Pisarevsky over 13 years ago
The code is incorrect. Any matrix, even if it's single-row or single-column matrix, has 2 dimensions. Thus, you need to allocate 2 elements for index.
... for(int r=0; r<dists.rows; ++r) { double minVal; int minIdxr2; cv::minMaxIdx(dists.col(r), &minVal, NULL, minIdx); cout << 0 << " " << minVal << " " << minIdxr0 << " " << minIdxr1 << endl; } ...
- Status changed from Open to Done
- (deleted custom field) set to invalid
Updated by Andrey Kamaev almost 13 years ago
- Status changed from Done to Cancelled
- Target version set to 2.4.0