You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	avcodec/jpeg2000dec: add some sanity checking on newpasses
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		| @@ -71,6 +71,8 @@ enum Jpeg2000Quantsty { // quantization style | ||||
| #define JPEG2000_MAX_DECLEVELS 32 | ||||
| #define JPEG2000_MAX_RESLEVELS (JPEG2000_MAX_DECLEVELS + 1) | ||||
|  | ||||
| #define JPEG2000_MAX_PASSES 100 | ||||
|  | ||||
| // T1 flags | ||||
| // flags determining significance of neighbor coefficients | ||||
| #define JPEG2000_T1_SIG_N  0x0001 | ||||
|   | ||||
| @@ -805,6 +805,11 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, | ||||
|             } | ||||
|             if ((newpasses = getnpasses(s)) < 0) | ||||
|                 return newpasses; | ||||
|             av_assert2(newpasses > 0); | ||||
|             if (cblk->npasses + newpasses >= JPEG2000_MAX_PASSES) { | ||||
|                 avpriv_request_sample(s->avctx, "Too many passes\n"); | ||||
|                 return AVERROR_PATCHWELCOME; | ||||
|             } | ||||
|             if ((llen = getlblockinc(s)) < 0) | ||||
|                 return llen; | ||||
|             if (cblk->lblock + llen + av_log2(newpasses) > 16) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user