Browse Source

avcodec/dvdsubdec: Fix buf_size check

Fixes out of array access

Found-by: Thomas Garnier using libFuzzer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 25ab1a65f3)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.4.14
Michael Niedermayer 9 years ago
parent
commit
1869ba95f6
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavcodec/dvdsubdec.c

+ 2
- 1
libavcodec/dvdsubdec.c View File

@@ -506,7 +506,8 @@ static int append_to_cached_buf(AVCodecContext *avctx,
{
DVDSubContext *ctx = avctx->priv_data;

if (ctx->buf_size >= sizeof(ctx->buf) - buf_size) {
av_assert0(buf_size >= 0 && ctx->buf_size <= sizeof(ctx->buf));
if (buf_size >= sizeof(ctx->buf) - ctx->buf_size) {
av_log(avctx, AV_LOG_WARNING, "Attempt to reconstruct "
"too large SPU packets aborted.\n");
return AVERROR_INVALIDDATA;


Loading…
Cancel
Save