]> granicus.if.org Git - libass/commitdiff
Accept colors with arbitrary sequences of leading & and H
authorOleg Oshmyan <chortos@inbox.lv>
Thu, 26 Dec 2013 02:50:19 +0000 (04:50 +0200)
committerOleg Oshmyan <chortos@inbox.lv>
Tue, 7 Jan 2014 21:00:01 +0000 (23:00 +0200)
libass/ass_utils.c

index 3dab74ca41063e0a90bedebec4df553dbc15a9a0..3c2c40a3e7cbe87c430529367d052c365e95b7d1 100644 (file)
@@ -81,7 +81,8 @@ int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex)
     int base = hex ? 16 : 10;
 
     if (*p == '&')
-        ++p;
+        while (*p == '&')
+            ++p;
     else
         ass_msg(library, MSGL_DBG2, "suspicious color format: \"%s\"\n", p);
 
@@ -92,6 +93,9 @@ int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex)
         result = mystrtou32(&p, base, &color);
     }
 
+    while (*p == '&' || *p == 'H')
+        ++p;
+
     {
         unsigned char *tmp = (unsigned char *) (&color);
         unsigned char b;