diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 939cfb2dca..77706c0cda 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -750,6 +750,11 @@ static int tiff_decode_tag(TiffContext *s) "Samples per pixel requires a single value, many provided\n"); return AVERROR_INVALIDDATA; } + if (value > 4U) { + av_log(s->avctx, AV_LOG_ERROR, + "Samples per pixel %d is too large\n", value); + return AVERROR_INVALIDDATA; + } if (s->bppcount == 1) s->bpp *= value; s->bppcount = value;