From 9f21dbe6aeed336632dadd500c98b2ff7eab3cfa Mon Sep 17 00:00:00 2001 From: Oneric Date: Wed, 3 Jan 2024 23:57:20 +0100 Subject: [PATCH] drawing: reject drawings not starting with m Fixes https://github.com/libass/libass/issues/719 --- libass/ass_drawing.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c index 43cf9c3b6..934342566 100644 --- a/libass/ass_drawing.c +++ b/libass/ass_drawing.c @@ -108,8 +108,21 @@ static ASS_DrawingToken *drawing_tokenize(const char *str) tail->next = calloc(1, sizeof(ASS_DrawingToken)); tail->next->prev = tail; tail = tail->next; - } else + } else { + /* VSFilter compat: + * In guliverkli(2) VSFilter all drawings + * whose first valid command isn't m are rejected. + * xy-VSF and MPC-HC ISR this was (possibly inadvertenly) later relaxed, + * such that all valid commands but n are ignored if there was no m yet. + */ + if (type == TOKEN_MOVE_NC) { + return NULL; + } else if (type != TOKEN_MOVE) { + p++; + continue; + } root = tail = calloc(1, sizeof(ASS_DrawingToken)); + } tail->type = type; tail->point = point; is_set = 0;