summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-06-05 20:39:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-06-18 16:05:23 +0200
commit42b26b41a4e626fc9dbcb5e897a21729b2c85c87 (patch)
treeb3b847673040bbf6c1d80b62e0c83c98c55b8cf0
parentbcf63142d1596095d3ae72bd8a8807bc77f500b2 (diff)
downloadffmpeg-42b26b41a4e626fc9dbcb5e897a21729b2c85c87.tar.gz
avcodec/tiff: Avoid loosing allocated geotag values
Fixes memleak Fixes: 2076/clusterfuzz-testcase-minimized-6542640243802112 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 d7cbeab4c1381f95ed0ebf85d7950bee96f66164) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index dac406862d..c46f771565 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1122,6 +1122,8 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
bytestream2_seek(&s->gb, pos + s->geotags[i].offset, SEEK_SET);
if (bytestream2_get_bytes_left(&s->gb) < s->geotags[i].count)
return AVERROR_INVALIDDATA;
+ if (s->geotags[i].val)
+ return AVERROR_INVALIDDATA;
ap = av_malloc(s->geotags[i].count);
if (!ap) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");