diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-10-26 16:29:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-11-26 15:12:26 +0100 |
commit | 3177ea512f4b6cab403add5f17f38321a8bfd69f (patch) | |
tree | 93c8cb2a2da76fb94f71ef2818936fde8e85b0cb /libavcodec | |
parent | e25441912baf76d61ce216f6efc24ffcc83f707a (diff) | |
download | ffmpeg-3177ea512f4b6cab403add5f17f38321a8bfd69f.tar.gz |
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 25ab1a65f3acb5ec67b53fb7a2463a7368f1ad16)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dvdsubdec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index f009824401..7fa117dab3 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -516,7 +516,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"); ctx->buf_size = 0; |