tiffdec: better checks for bitstream offsets, fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-11-29 15:34:29 +01:00
parent 3ae6104511
commit 27eada287a

View File

@ -1079,12 +1079,12 @@ static int decode_frame(AVCodecContext *avctx,
dst = p->data[0];
if (s->stripsizesoff) {
if (s->stripsizesoff >= avpkt->size)
if (s->stripsizesoff >= (unsigned)avpkt->size)
return AVERROR_INVALIDDATA;
bytestream2_init(&stripsizes, avpkt->data + s->stripsizesoff, avpkt->size - s->stripsizesoff);
}
if (s->strippos) {
if (s->strippos >= avpkt->size)
if (s->strippos >= (unsigned)avpkt->size)
return AVERROR_INVALIDDATA;
bytestream2_init(&stripdata, avpkt->data + s->strippos, avpkt->size - s->strippos);
}