cv::reduce() doesn't check if input Mat is empty that can cause crash (Feature #2589)
Description
Mat labels_32f, CVy_sum;
reduce(labels_32f, CVy_sum, 1, CV_REDUCE_SUM, CV_32F);
labels_32f is empty
This construction doesn't produce any assertion error.
Associated revisions
Merge pull request #2589 from alalek:icv_update
History
Updated by Anna Kogan over 12 years ago
Hello Rafal,
Seems your code doesn't make much sense. Why do you want to reduce an empty matrix?
Updated by Anna Kogan over 12 years ago
- Category changed from core to trash
Updated by Anna Kogan over 12 years ago
- Category changed from trash to core
Updated by Rafal Kapela about 12 years ago
Dear Anna,
I know that this is not something very useful but it can save a lot of time when these kind of situations would be detected. You can spent a couple of hours before you detect it yourself, if you have a lot of lines. Good code should avoid this kind of situations.
Updated by Andrey Pavlenko about 12 years ago
- Subject changed from cv::reduce takes long time for empty matrices and does not produce any error to cv::reduce() doesn't check if input Mat is empty that can cause crash
- Target version set to 2.4.4
- Start date deleted (
2012-11-30)
Updated by Daniil Osokin about 12 years ago
Hi, Rafal!
I've executed the code, mentioned above, and it doesn't crash. Here is no bug. If you pass an empty Mat you have the empty result. So, if you want to change this behaviour, please submit a patch with necessary assertions for this function. Could you do this (otherwise I'll close this ticket)?
- Tracker changed from Bug to Feature
Updated by Daniil Osokin about 12 years ago
- Assignee changed from Vadim Pisarevsky to Rafal Kapela
Updated by Daniil Osokin about 12 years ago
Rafal, this ticket is cancelled. You could reopen it, as soon as you'll have free time.
- Status changed from Open to Cancelled