aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-07-10 17:14:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-11 00:25:33 +0200
commit5086d2269747234bd371729a34b7f30467443460 (patch)
tree4c0a0a746ddf5d1e655d52f61b7ff373014300b4
parent3c4679c4302d04fdd92eca65321fe0af5cc08a42 (diff)
downloadffmpeg-5086d2269747234bd371729a34b7f30467443460.tar.gz
avcodec/tiff: Check input space in dng_decode_jpeg()
Fixes: out of array read Fixes: 24034/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5111884337119232 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 79e8d17024e6c6328a40fcee191ffd70798a9c6e) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 6a3ec3ef95..18b327e800 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -882,6 +882,9 @@ static int dng_decode_jpeg(AVCodecContext *avctx, AVFrame *frame,
int is_single_comp, is_u16, pixel_size;
int ret;
+ if (tile_byte_count < 0 || tile_byte_count > bytestream2_get_bytes_left(&s->gb))
+ return AVERROR_INVALIDDATA;
+
/* Prepare a packet and send to the MJPEG decoder */
av_init_packet(&jpkt);
jpkt.data = (uint8_t*)s->gb.buffer;