diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-12 00:09:57 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-11-14 23:30:37 +0100 |
commit | b27afd717d21730df02d22f4dc93e13a02be93ec (patch) | |
tree | b1225ec74ba2c51166922bd708d9913dc8396e0a | |
parent | 76f6712057e1e6ad0f9f2a8e4f83c4656e24e81e (diff) | |
download | ffmpeg-b27afd717d21730df02d22f4dc93e13a02be93ec.tar.gz |
avcodec/ivi: Move buffer/block end check to caller of ivi_dc_transform()
Fixes: assertion failure
Fixes: 14078/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO5_fuzzer-5760571284127744
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 110dce96331529a13cc815d3c852aed9d37f83d0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/ivi.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c index cea40d82ca..68cef856d4 100644 --- a/libavcodec/ivi.c +++ b/libavcodec/ivi.c @@ -488,12 +488,6 @@ static int ivi_dec_tile_data_size(GetBitContext *gb) static int ivi_dc_transform(IVIBandDesc *band, int *prev_dc, int buf_offs, int blk_size) { - int buf_size = band->pitch * band->aheight - buf_offs; - int min_size = (blk_size - 1) * band->pitch + blk_size; - - if (min_size > buf_size) - return AVERROR_INVALIDDATA; - band->dc_transform(prev_dc, band->buf + buf_offs, band->pitch, blk_size); @@ -724,6 +718,11 @@ static int ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, if (ret < 0) return ret; } else { + int buf_size = band->pitch * band->aheight - buf_offs; + int min_size = (blk_size - 1) * band->pitch + blk_size; + + if (min_size > buf_size) + return AVERROR_INVALIDDATA; /* block not coded */ /* for intra blocks apply the dc slant transform */ /* for inter - perform the motion compensation without delta */ |