[opencv] 23/98: Fixed "Conditional jump or move depends on uninitialised value(s)" valgrind issue due to wrong pointer recalculation for zero level of pyramid.

Mattia Rizzolo mattia at debian.org
Tue Oct 4 17:51:20 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 2.4.13
in repository opencv.

commit f01f1bc5e67f96a470f573888541e5c03e66cc3c
Author: Vitaly Tuzov <vitaly.tuzov at itseez.com>
Date:   Wed Jan 20 19:20:36 2016 +0300

    Fixed "Conditional jump or move depends on uninitialised value(s)" valgrind issue due to wrong pointer recalculation for zero level of pyramid.
---
 modules/legacy/src/pyrsegmentation.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/legacy/src/pyrsegmentation.cpp b/modules/legacy/src/pyrsegmentation.cpp
index c64b7bc..30fed0e 100644
--- a/modules/legacy/src/pyrsegmentation.cpp
+++ b/modules/legacy/src/pyrsegmentation.cpp
@@ -130,8 +130,8 @@ static void icvMaxRoi1( _CvRect16u *max_rect, int x, int y );
                                        (float)fabs((a).green - (b).green),  \
                                        (float)fabs((a).blue - (b).blue))*/
 
-#define _CV_NEXT_BASE_C1(p,n) (_CvPyramid*)((char*)(p) + (n)*sizeof(_CvPyramidBase))
-#define _CV_NEXT_BASE_C3(p,n) (_CvPyramidC3*)((char*)(p) + (n)*sizeof(_CvPyramidBaseC3))
+#define _CV_NEXT_BASE_C1(p,n) ((_CvPyramid*)((char*)(p) + (n)*(ptrdiff_t)sizeof(_CvPyramidBase)))
+#define _CV_NEXT_BASE_C3(p,n) ((_CvPyramidC3*)((char*)(p) + (n)*(ptrdiff_t)sizeof(_CvPyramidBaseC3)))
 
 
 CV_INLINE float icvRGBDist_Max( const _CvRGBf& a, const _CvRGBf& b )
@@ -868,7 +868,7 @@ icvPyrSegmentation8uC3R( uchar * src_image, int src_step,
 
                     if( p_cur[size.width].a == 0 )
                     {
-                        p_cur[size.width].c = p_prev[(l != 0) - 1].c;
+                        p_cur[size.width].c = (l != 0) ? p_prev->c : _CV_NEXT_BASE_C3( p_prev, -1 )->c;
                     }
                     else
                     {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list