summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-06 21:42:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-08-07 14:01:00 +0200
commitbe090da25f734460f3105075456877b8a66185c1 (patch)
tree418865568dcb25360dc8ca8269038fe00a9cefd2 /libavcodec/tiff.c
parentd51d569cf68f78aaea8464a156c847a0e294726a (diff)
downloadffmpeg-be090da25f734460f3105075456877b8a66185c1.tar.gz
avcodec/tiff: Check bpp/bppcount for 0
Fixes: division by zero Fixes: 24253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-6250318007107584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 18b327e800..08dbca9d60 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1290,7 +1290,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
s->height = value;
break;
case TIFF_BPP:
- if (count > 5U) {
+ if (count > 5 || count <= 0) {
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, %d components)\n",
value, count);
@@ -1321,9 +1321,9 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
"Samples per pixel requires a single value, many provided\n");
return AVERROR_INVALIDDATA;
}
- if (value > 5U) {
+ if (value > 5 || value <= 0) {
av_log(s->avctx, AV_LOG_ERROR,
- "Samples per pixel %d is too large\n", value);
+ "Invalid samples per pixel %d\n", value);
return AVERROR_INVALIDDATA;
}
if (s->bppcount == 1)