diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-03-21 01:55:01 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-16 16:00:22 +0200 |
commit | 8fc7fd63f21fc7c6c25b13805864626e15a886c5 (patch) | |
tree | 0eae1dccf75c5f62899e209cd4c954731864402b | |
parent | 184d957b5401b209fcaf0efecf0f7e973e4f78d0 (diff) | |
download | ffmpeg-8fc7fd63f21fc7c6c25b13805864626e15a886c5.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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 70e34b469d..3bc31a4545 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1056,7 +1056,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; } |