Commit 43e3b838 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed potential memory buffer corruption in StereoSGBM (patch #2203)

parent 8528b0ab
...@@ -415,7 +415,7 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2, ...@@ -415,7 +415,7 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2,
// thus we shift the pointers by 8 (8*sizeof(short) == 16 - ideal alignment) // thus we shift the pointers by 8 (8*sizeof(short) == 16 - ideal alignment)
Lr[k] = pixDiff + costBufSize + LrSize*k + NRD2*LrBorder + 8; Lr[k] = pixDiff + costBufSize + LrSize*k + NRD2*LrBorder + 8;
memset( Lr[k] - LrBorder*NRD2 - 8, 0, LrSize*sizeof(CostType) ); memset( Lr[k] - LrBorder*NRD2 - 8, 0, LrSize*sizeof(CostType) );
minLr[k] = pixDiff + costBufSize + LrSize*NLR + minLrSize*k + NR2*2; minLr[k] = pixDiff + costBufSize + LrSize*NLR + minLrSize*k + NR2*LrBorder;
memset( minLr[k] - LrBorder*NR2, 0, minLrSize*sizeof(CostType) ); memset( minLr[k] - LrBorder*NR2, 0, minLrSize*sizeof(CostType) );
} }
......
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