From 7a3f45457b04977ea3d8a59ad66f802fadd43fcb Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sat, 29 Aug 2009 20:26:20 +0200 Subject: [PATCH] Do not close empty drawings If there are no points (i.e. illegal drawing), do not close the drawing by incrementing the contour counter. Under certain circumstances, this can crash the FreeType stroker. This fixes issue 7. --- libass/ass_drawing.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c index 95348a2..8c5f062 100644 --- a/libass/ass_drawing.c +++ b/libass/ass_drawing.c @@ -86,8 +86,10 @@ static inline void drawing_close_shape(ASS_Drawing *drawing) drawing->max_contours); } - ol->contours[ol->n_contours] = ol->n_points - 1; - ol->n_contours++; + if (ol->n_points) { + ol->contours[ol->n_contours] = ol->n_points - 1; + ol->n_contours++; + } } /* -- 2.50.1