From 00304fe71c1f273cecf789e68e8a4c0f2bc2fe6c Mon Sep 17 00:00:00 2001 From: mshabunin Date: Thu, 15 Dec 2016 19:08:14 +0300 Subject: [PATCH] SGBM: fixed uninitialized memory in cost buffer --- modules/calib3d/src/stereosgbm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/calib3d/src/stereosgbm.cpp b/modules/calib3d/src/stereosgbm.cpp index 203cbc6c31bf..27ce62e6f9af 100644 --- a/modules/calib3d/src/stereosgbm.cpp +++ b/modules/calib3d/src/stereosgbm.cpp @@ -366,7 +366,7 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2, PixType* tempBuf = (PixType*)(disp2ptr + width); // add P2 to every C(x,y). it saves a few operations in the inner loops - for( k = 0; k < width1*D; k++ ) + for(k = 0; k < (int)CSBufSize; k++ ) Cbuf[k] = (CostType)P2; for( int pass = 1; pass <= npasses; pass++ )