aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-06 21:42:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-10-05 21:28:08 +0200
commit8ae6def1e033261b65d73a3d48f6bb9ffa6647ba (patch)
treec07989749aee93845d9b349256726aa3e54258be
parentf955b6efabcea6f3340f788d5cb8b90961359e92 (diff)
downloadffmpeg-8ae6def1e033261b65d73a3d48f6bb9ffa6647ba.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> (cherry picked from commit be090da25f734460f3105075456877b8a66185c1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/tiff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 1f1a1a3698..14b88497bf 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -965,7 +965,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);
@@ -996,9 +996,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)