Fix canny segment fault (Bug #3978)
Avoid stack overflow based on std::vector cause std::vector::resize() segmentation fault.
This commit is contained in:
parent
4f2aeeffaa
commit
184b6e314c
@ -453,7 +453,7 @@ void cv::Canny( InputArray _src, OutputArray _dst,
|
||||
if ((stack_top - stack_bottom) + src.cols > maxsize)
|
||||
{
|
||||
int sz = (int)(stack_top - stack_bottom);
|
||||
maxsize = maxsize * 3/2;
|
||||
maxsize = std::max(maxsize * 3/2, sz + src.cols);
|
||||
stack.resize(maxsize);
|
||||
stack_bottom = &stack[0];
|
||||
stack_top = stack_bottom + sz;
|
||||
|
Loading…
Reference in New Issue
Block a user