You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	avcodec/ffv1dec: Check chroma shift parameters
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		| @@ -547,6 +547,12 @@ static int read_extra_header(FFV1Context *f) | ||||
|     f->num_h_slices               = 1 + get_symbol(c, state, 0); | ||||
|     f->num_v_slices               = 1 + get_symbol(c, state, 0); | ||||
|  | ||||
|     if (f->chroma_h_shift > 4U || f->chroma_v_shift > 4U) { | ||||
|         av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n", | ||||
|                f->chroma_h_shift, f->chroma_v_shift); | ||||
|         return AVERROR_INVALIDDATA; | ||||
|     } | ||||
|  | ||||
|     if (f->num_h_slices > (unsigned)f->width  || !f->num_h_slices || | ||||
|         f->num_v_slices > (unsigned)f->height || !f->num_v_slices | ||||
|        ) { | ||||
| @@ -652,6 +658,12 @@ static int read_header(FFV1Context *f) | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (chroma_h_shift > 4U || chroma_v_shift > 4U) { | ||||
|             av_log(f->avctx, AV_LOG_ERROR, "chroma shift parameters %d %d are invalid\n", | ||||
|                    chroma_h_shift, chroma_v_shift); | ||||
|             return AVERROR_INVALIDDATA; | ||||
|         } | ||||
|  | ||||
|         f->colorspace                 = colorspace; | ||||
|         f->avctx->bits_per_raw_sample = bits_per_raw_sample; | ||||
|         f->chroma_planes              = chroma_planes; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user