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

Fixes potential heap-buffer-overflow.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
pull/362/head
Andreas Rheinhardt 4 years ago committed by Andreas Rheinhardt
parent 0062aca592
commit f38f791a23
  1. 2
      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) {

Loading…
Cancel
Save