sanm: Use the correct height variable in the decoded_size checks
Fixes integer overflow and out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
							parent
							
								
									4ee88db840
								
							
						
					
					
						commit
						5260edee7e
					
				@ -420,8 +420,8 @@ static int old_codec37(SANMVideoContext *ctx, int top,
 | 
			
		||||
    flags        = bytestream2_get_byte(&ctx->gb);
 | 
			
		||||
    bytestream2_skip(&ctx->gb, 3);
 | 
			
		||||
 | 
			
		||||
    if (decoded_size > height * stride - left - top * stride) {
 | 
			
		||||
        decoded_size = height * stride - left - top * stride;
 | 
			
		||||
    if (decoded_size > ctx->height * stride - left - top * stride) {
 | 
			
		||||
        decoded_size = ctx->height * stride - left - top * stride;
 | 
			
		||||
        av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -658,8 +658,8 @@ static int old_codec47(SANMVideoContext *ctx, int top,
 | 
			
		||||
    decoded_size = bytestream2_get_le32(&ctx->gb);
 | 
			
		||||
    bytestream2_skip(&ctx->gb, 8);
 | 
			
		||||
 | 
			
		||||
    if (decoded_size > height * stride - left - top * stride) {
 | 
			
		||||
        decoded_size = height * stride - left - top * stride;
 | 
			
		||||
    if (decoded_size > ctx->height * stride - left - top * stride) {
 | 
			
		||||
        decoded_size = ctx->height * stride - left - top * stride;
 | 
			
		||||
        av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user