aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-03-21 01:55:01 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-23 13:15:17 +0200
commit78664297df0e94bb38571fc6abc59d2a16af6454 (patch)
treeee2f2dff3b8c6b3be43f2b1cfb3648e5ac4aaa56
parent6c06cd65a236be9c6e9b109d33192ab796857e74 (diff)
downloadffmpeg-78664297df0e94bb38571fc6abc59d2a16af6454.tar.gz
avcodec/tiff: Check geotag count for being non zero
Fixes memleak Fixes: 874/clusterfuzz-testcase-5252796175613952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3182e19c1c29eef60208a67ad8ecad1d9a2d0694) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 45d3e1ded0..4ef509774d 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1057,7 +1057,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
s->geotag_count = count / 4 - 1;
av_log(s->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n");
}
- if (bytestream2_get_bytes_left(&s->gb) < s->geotag_count * sizeof(int16_t) * 4) {
+ if ( bytestream2_get_bytes_left(&s->gb) < s->geotag_count * sizeof(int16_t) * 4
+ || s->geotag_count == 0) {
s->geotag_count = 0;
return -1;
}