[FFmpeg-devel] [PATCH 11/23] lavc/ass_split: fix parsing utf8 scripts

John Stebbins jstebbins at jetheaddev.com
Mon Apr 6 20:52:06 EEST 2020


The [Script Info] section was skipped if starts with UTF8 BOM
---
 libavcodec/ass_split.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index 67da7c6d84..94c32667af 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -354,6 +354,9 @@ static int ass_split(ASSSplitContext *ctx, const char *buf)
     if (ctx->current_section >= 0)
         buf = ass_split_section(ctx, buf);
 
+    if(!memcmp(buf, "\xef\xbb\xbf", 3)) { // Skip UTF-8 BOM header
+        buf += 3;
+    }
     while (buf && *buf) {
         if (sscanf(buf, "[%15[0-9A-Za-z+ ]]%c", section, &c) == 2) {
             buf += strcspn(buf, "\n");
-- 
2.25.1



More information about the ffmpeg-devel mailing list