Browse Source

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 3182e19c1c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.4.14
Michael Niedermayer 9 years ago
parent
commit
78664297df
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavcodec/tiff.c

+ 2
- 1
libavcodec/tiff.c View File

@@ -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;
}


Loading…
Cancel
Save