From bb9bd3132ae7f0c99a981212e8c20e143be70a05 Mon Sep 17 00:00:00 2001 From: berak Date: Tue, 6 Oct 2015 18:25:24 +0200 Subject: [PATCH] fix zero length std::string in putText() --- modules/core/src/drawing.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/drawing.cpp b/modules/core/src/drawing.cpp index eac12e7..63ce0f2 100644 --- a/modules/core/src/drawing.cpp +++ b/modules/core/src/drawing.cpp @@ -1960,7 +1960,7 @@ void putText( Mat& img, const string& text, Point org, pts.reserve(1 << 10); const char **faces = cv::g_HersheyGlyphs; - for( int i = 0; text[i] != '\0'; i++ ) + for( int i = 0; i < (int)text.size(); i++ ) { int c = (uchar)text[i]; Point p; @@ -2008,7 +2008,7 @@ Size getTextSize( const string& text, int fontFace, double fontScale, int thickn int cap_line = (ascii[0] >> 4) & 15; size.height = cvRound((cap_line + base_line)*fontScale + (thickness+1)/2); - for( int i = 0; text[i] != '\0'; i++ ) + for( int i = 0; i < (int)text.size(); i++ ) { int c = (uchar)text[i]; Point p; -- 2.7.4