apedec: check bits <= 32.
Fixes a floating-point exception further down.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
(cherry picked from commit 420d1df2e2)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Reinhard Tartler
					
				
			
			
				
	
			
			
			
						parent
						
							be424d86a8
						
					
				
				
					commit
					e8050f313e
				
			@@ -404,9 +404,12 @@ static inline int ape_decode_value(APEContext *ctx, APERice *rice)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (tmpk <= 16)
 | 
					        if (tmpk <= 16)
 | 
				
			||||||
            x = range_decode_bits(ctx, tmpk);
 | 
					            x = range_decode_bits(ctx, tmpk);
 | 
				
			||||||
        else {
 | 
					        else if (tmpk <= 32) {
 | 
				
			||||||
            x = range_decode_bits(ctx, 16);
 | 
					            x = range_decode_bits(ctx, 16);
 | 
				
			||||||
            x |= (range_decode_bits(ctx, tmpk - 16) << 16);
 | 
					            x |= (range_decode_bits(ctx, tmpk - 16) << 16);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk);
 | 
				
			||||||
 | 
					            return AVERROR_INVALIDDATA;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        x += overflow << tmpk;
 | 
					        x += overflow << tmpk;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user