diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 00ff8d3e39..930da9ff3e 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -386,11 +386,11 @@ static int tiff_decode_tag(TiffContext *s) s->height = value; break; case TIFF_BPP: - s->bppcount = count; - if(count > 4){ - av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count); + if(count > 4U){ + av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", value, count); return -1; } + s->bppcount = count; if(count == 1) s->bpp = value; else{ switch(type){ @@ -407,6 +407,13 @@ static int tiff_decode_tag(TiffContext *s) s->bpp = -1; } } + if (s->bpp > 64U) { + av_log(s->avctx, AV_LOG_ERROR, + "This format is not supported (bpp=%d, %d components)\n", + s->bpp, count); + s->bpp = 0; + return AVERROR_INVALIDDATA; + } break; case TIFF_SAMPLES_PER_PIXEL: if (count != 1) {