]> granicus.if.org Git - libass/commitdiff
Do not close empty drawings
authorGrigori Goronzy <greg@hein>
Sat, 29 Aug 2009 18:26:20 +0000 (20:26 +0200)
committerGrigori Goronzy <greg@hein>
Sat, 29 Aug 2009 18:26:20 +0000 (20:26 +0200)
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

index 95348a24845460e090488f53c5abab0b5652ff1d..8c5f062bc6e8852023b153512d62b2297f4506fa 100644 (file)
@@ -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++;
+    }
 }
 
 /*