From a7a0f92e589ef43707a05b7de90033cde9102a38 Mon Sep 17 00:00:00 2001 From: Jonathan Bohren Date: Wed, 20 Mar 2013 16:49:59 -0400 Subject: [PATCH] Fixing segfault for near-zero-sized ellipses --- modules/core/src/drawing.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/core/src/drawing.cpp b/modules/core/src/drawing.cpp index 8850c6ec4c..a6d5287be7 100644 --- a/modules/core/src/drawing.cpp +++ b/modules/core/src/drawing.cpp @@ -890,8 +890,10 @@ void ellipse2Poly( Point center, Size axes, int angle, pts.push_back(pt); } - if( pts.size() < 2 ) - pts.push_back(pts[0]); + // If there are no points, it's a zero-size polygon + if( pts.size() < 2) { + pts.assign(2,center); + } }