]> granicus.if.org Git - libass/commitdiff
Clip tag arguments are not optional
authorwm4 <wm4@nowhere>
Fri, 12 Apr 2013 16:34:30 +0000 (18:34 +0200)
committerwm4 <wm4@nowhere>
Fri, 12 Apr 2013 16:34:30 +0000 (18:34 +0200)
This fixes: {\clip(1,1,20,20)\clip\alpha&H1E&\c&HC7E5C0&}X

libass tries to interpret the second \clip, which has no arguments.
Since the parsing code doesn't require a starting '(', the parser will
skip over the other tags (treating them as junk) and interpret the
numbers that happen to be in the rest of the string. The result is a
bogus drawing command, which happens to rasterize an extremely wide
glyph, which takes several seconds to finish.

Make the '('  required. Neither the aegisub manual nor the vsfilter
source code have any indication that \clip without starting '(' is
allowed, so this should not break anything.

libass/ass_parse.c

index f2f73e5babf89075dae2e401a6f400d86967b853..bb649715e44d0e09fecdf7a20c6d6004a94aaa55 100644 (file)
@@ -311,7 +311,7 @@ char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
         int x0, y0, x1, y1;
         int res = 1;
         char *start = p;
-        skipopt('(');
+        skip('(');
         res &= mystrtoi(&p, &x0);
         skipopt(',');
         res &= mystrtoi(&p, &y0);
@@ -669,7 +669,7 @@ char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
         char *start = p;
         int x0, y0, x1, y1;
         int res = 1;
-        skipopt('(');
+        skip('(');
         res &= mystrtoi(&p, &x0);
         skipopt(',');
         res &= mystrtoi(&p, &y0);