aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-06 21:42:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:37:20 +0200
commitb0fd8d6b1523f4f89f20e3a34ffa6a39156a2d56 (patch)
tree62932b6222dfcf05597eb80c0d30a69990587b06
parent2dc9462462ac160ea0345dfe256d85b934de19a3 (diff)
downloadffmpeg-b0fd8d6b1523f4f89f20e3a34ffa6a39156a2d56.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 bf17d9fe60..a9f93494ed 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -831,7 +831,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
s->height = value;
break;
case TIFF_BPP:
- if (count > 4U) {
+ if (count > 4 || count <= 0) {
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, %d components)\n",
value, count);
@@ -862,9 +862,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 > 4U) {
+ if (value > 4 || 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)