[FFmpeg-cvslog] avcodec/ass_split: Don't presume strlen to be >= 2

Andreas Rheinhardt git at videolan.org
Sat Apr 3 01:19:19 EEST 2021


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Dec  1 14:24:10 2020 +0100| [0fe3383066db70c3c60c4137a0a83e26f992e906] | committer: Andreas Rheinhardt

avcodec/ass_split: Don't presume strlen to be >= 2

Fixes potential heap-buffer-overflow.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
(cherry picked from commit f38f791a23a8acade7ea6554c80455dce7543dbd)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0fe3383066db70c3c60c4137a0a83e26f992e906
---

 libavcodec/ass_split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index c2c388d9f0..189272bbd9 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list