FilterEngine::init() crashes if kernel width is 1 & BORDER_CONSTANT (Bug #1089)


Added by Timm Linder almost 14 years ago. Updated almost 14 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:imgproc, video
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

I tried calling the filter2D() method with a 1x2 kernel and mode BORDER_CONSTANT, which led to a vector subscript out of bounds exception.

The problem is located in filter.cpp, line 187:
if( rowBorderType BORDER_CONSTANT || columnBorderType BORDER_CONSTANT ) {
constBorderValue.resize(srcElemSize*(ksize.width - 1));
scalarToRawData(_borderValue, &constBorderValuer0, ...

Accessing constBorderValuer0 fails because the vector is resized to length 0 (because ksize.width - 1 == 0).

While a horizontal border is not needed with a kernel width of 1, a constant vertical border might still be required; therefore, this should be fixed.


Related issues

duplicates Bug #1099: dilate() and erode() can't run with 1 width element Done

Associated revisions

Revision 4d45b3e7
Added by Roman Donchenko over 11 years ago

Merge pull request #1089 from SpecLad:contract-violations

History

Updated by Vadim Pisarevsky almost 14 years ago

duplicate of #1099 (or vice versa). fixed in trunk

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF