From 628b23acc854232f95fbbc3f5158a4f84e53680d Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Wed, 13 Aug 2014 13:46:43 +0400 Subject: [PATCH] GCC 4.8 warning array subscript is above array bounds fixed. (cherry picked from commit e11333dd831ef43f962e513e26f3dfa6dc789155) --- modules/imgproc/src/floodfill.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/imgproc/src/floodfill.cpp b/modules/imgproc/src/floodfill.cpp index db2563ddea..87fca7ce2d 100644 --- a/modules/imgproc/src/floodfill.cpp +++ b/modules/imgproc/src/floodfill.cpp @@ -470,6 +470,12 @@ cvFloodFill( CvArr* arr, CvPoint seed_point, depth = CV_MAT_DEPTH(type); cn = CV_MAT_CN(type); + if ( (cn != 1) && (cn != 3) ) + { + CV_Error( CV_StsBadArg, "Number of channels in input image must be 1 or 3" ); + return; + } + if( connectivity == 0 ) connectivity = 4; else if( connectivity != 4 && connectivity != 8 )