]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/ass_split: Don't presume strlen to be >= 2
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 1 Dec 2020 13:24:10 +0000 (14:24 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 2 Apr 2021 17:07:59 +0000 (19:07 +0200)
Fixes potential heap-buffer-overflow.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/ass_split.c

index c2c388d9f05e93164f9e8083a0dcb315654bfd8c..189272bbd98ebfb6999d83f0202b6607ada0655c 100644 (file)
@@ -376,7 +376,7 @@ 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
+    if (buf && !strncmp(buf, "\xef\xbb\xbf", 3)) // Skip UTF-8 BOM header
         buf += 3;
     ctx->current_section = -1;
     if (ass_split(ctx, buf) < 0) {