Message ID | 20200406183532.1302565-1-jstebbins@jetheaddev.com |
---|---|
State | Accepted |
Commit | a52eef68d4ba4b7166b8a7681e1a8812c2866823 |
Headers | show |
Series | None | expand |
On Mon, 6 Apr 2020 12:35:32 -0600 John Stebbins <jstebbins@jetheaddev.com> wrote: > The [Script Info] section was skipped if starts with UTF8 BOM > --- > libavcodec/ass_split.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c > index 67da7c6d84..c2c388d9f0 100644 > --- a/libavcodec/ass_split.c > +++ b/libavcodec/ass_split.c > @@ -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); LGTM --phil
diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index 67da7c6d84..c2c388d9f0 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -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);