aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-08-06 21:42:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:19 +0200
commita590a733fa97a95aecb060231f34fafcb63e553c (patch)
tree0aee1930f65e15b95de55541a728edaf85250323
parentab4e05cfed569c9c3677486c65ddea91c4df365d (diff)
downloadffmpeg-a590a733fa97a95aecb060231f34fafcb63e553c.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 da422c1459..b8d4e849c7 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -819,7 +819,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);
@@ -850,9 +850,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)