[FFmpeg-cvslog] avcodec/tiff: Avoid loosing allocated geotag values

Michael Niedermayer git at videolan.org
Wed Jun 7 01:05:21 EEST 2017


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Mon Jun  5 20:39:21 2017 +0200| [ec5e262e1d7294484e58499b758f0e29f0959915] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit d7cbeab4c1381f95ed0ebf85d7950bee96f66164)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec5e262e1d7294484e58499b758f0e29f0959915
---

 libavcodec/tiff.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 9b9d37bb83..81bf7ae54d 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1137,6 +1137,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");



More information about the ffmpeg-cvslog mailing list