You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	jpeg2000dec: Check ncomponents and tile dimensions
Fixes various problems Code ported from j2kdec Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		| @@ -176,6 +176,13 @@ static int get_siz(Jpeg2000DecoderContext *s) | ||||
|     s->tile_offset_y  = bytestream_get_be32(&s->buf); // YT0Siz | ||||
|     s->ncomponents    = bytestream_get_be16(&s->buf); // CSiz | ||||
|  | ||||
|     if(s->ncomponents <= 0 || s->ncomponents > 4) { | ||||
|         av_log(s->avctx, AV_LOG_ERROR, "unsupported/invalid ncomponents: %d\n", s->ncomponents); | ||||
|         return AVERROR(EINVAL); | ||||
|     } | ||||
|     if(s->tile_width<=0 || s->tile_height<=0) | ||||
|         return AVERROR(EINVAL); | ||||
|  | ||||
|     if (s->buf_end - s->buf < 2 * s->ncomponents) | ||||
|         return AVERROR(EINVAL); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user