Commit e0cea92f authored by sbokov's avatar sbokov

Fixing possible invalid memory access in validateDisparity

parent ff1687d3
......@@ -1157,6 +1157,10 @@ void cv::validateDisparity( InputOutputArray _disp, InputArray _cost, int minDis
for( x = minX1; x < maxX1; x++ )
{
int d = dptr[x], c = cptr[x];
if( d == INVALID_DISP_SCALED )
continue;
int x2 = x - ((d + DISP_SCALE/2) >> DISP_SHIFT);
if( disp2cost[x2] > c )
......@@ -1173,9 +1177,13 @@ void cv::validateDisparity( InputOutputArray _disp, InputArray _cost, int minDis
for( x = minX1; x < maxX1; x++ )
{
int d = dptr[x], c = cptr[x];
if( d == INVALID_DISP_SCALED )
continue;
int x2 = x - ((d + DISP_SCALE/2) >> DISP_SHIFT);
if( disp2cost[x2] < c )
if( disp2cost[x2] > c )
{
disp2cost[x2] = c;
disp2buf[x2] = d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment