From fa36b9d3455d62e98554a996dea3ebf7201109c2 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 3 Jan 2017 22:18:27 +0300 Subject: [PATCH] imgproc: fix using of uninitialized edge[] members in FillConvexPoly --- modules/imgproc/src/drawing.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/imgproc/src/drawing.cpp b/modules/imgproc/src/drawing.cpp index 113f499..9099d73 100644 --- a/modules/imgproc/src/drawing.cpp +++ b/modules/imgproc/src/drawing.cpp @@ -1171,6 +1171,9 @@ FillConvexPoly( Mat& img, const Point2l* v, int npts, const void* color, int lin edge[0].di = 1; edge[1].di = npts - 1; + edge[0].x = edge[1].x = -XY_ONE; + edge[0].dx = edge[1].dx = 0; + ptr += img.step*y; do @@ -1213,6 +1216,9 @@ FillConvexPoly( Mat& img, const Point2l* v, int npts, const void* color, int lin } } + if (edges < 0) + break; + if (y >= 0) { int left = 0, right = 1; -- 2.7.4