Commit 25ab1a65 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/dvdsubdec: Fix buf_size check

Fixes out of array access

Found-by: Thomas Garnier using libFuzzer
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 20182e79
......@@ -548,7 +548,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment