1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-17 20:17:55 +02:00

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>
This commit is contained in:
Michael Niedermayer 2016-10-26 16:29:57 +02:00
parent 642cd5de4d
commit 8cca6b06ec

View File

@ -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;