From 02a325cb6fdc1e33a45191cbfbfe4298affcd021 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 9 Nov 2012 19:28:23 +0100 Subject: [PATCH] tiffdec: check rps, fix infinite loop. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/tiff.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 45c247694e..f00b1adc37 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1089,6 +1089,11 @@ static int decode_frame(AVCodecContext *avctx, bytestream2_init(&stripdata, avpkt->data + s->strippos, avpkt->size - s->strippos); } + if (s->rps <= 0) { + av_log(avctx, AV_LOG_ERROR, "rps %d invalid\n", s->rps); + return AVERROR_INVALIDDATA; + } + for (i = 0; i < s->height; i += s->rps) { if (s->stripsizesoff) ssize = tget(&stripsizes, s->sstype, s->le);