fix potential buffer overflow as in 3.0

This commit is contained in:
Jan Starzynski 2015-11-11 16:19:20 +01:00
parent 0f288d1082
commit 2799829bc9

View File

@ -230,7 +230,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(sz + src.cols, maxsize * 3/2);
stack.resize(maxsize);
stack_bottom = &stack[0];
stack_top = stack_bottom + sz;