]> git.sesse.net Git - ffmpeg/commitdiff
lavc/ass_split: fix parsing utf8 scripts
authorJohn Stebbins <jstebbins@jetheaddev.com>
Sat, 4 Apr 2020 19:17:33 +0000 (13:17 -0600)
committerPhilip Langdale <philipl@overt.org>
Fri, 10 Apr 2020 16:32:13 +0000 (09:32 -0700)
The [Script Info] section was skipped if starts with UTF8 BOM

Signed-off-by: Philip Langdale <philipl@overt.org>
libavcodec/ass_split.c

index 67da7c6d84c002861a52679c0cbe17ada12dc9f4..c2c388d9f05e93164f9e8083a0dcb315654bfd8c 100644 (file)
@@ -376,6 +376,8 @@ ASSSplitContext *ff_ass_split(const char *buf)
     ASSSplitContext *ctx = av_mallocz(sizeof(*ctx));
     if (!ctx)
         return NULL;
+    if (buf && !memcmp(buf, "\xef\xbb\xbf", 3)) // Skip UTF-8 BOM header
+        buf += 3;
     ctx->current_section = -1;
     if (ass_split(ctx, buf) < 0) {
         ff_ass_split_free(ctx);