lavc/ass_split: fix parsing utf8 scripts

The [Script Info] section was skipped if starts with UTF8 BOM

Signed-off-by: Philip Langdale <philipl@overt.org>
This commit is contained in:
John Stebbins 2020-04-04 13:17:33 -06:00 committed by Philip Langdale
parent b8d4a66b29
commit a52eef68d4
1 changed files with 2 additions and 0 deletions

View File

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