avcodec/amrnbdec: move channel_size bellow to avoid array overreads
This commit is contained in:
		
							parent
							
								
									17130321f3
								
							
						
					
					
						commit
						a97cad8b0b
					
				| @ -981,7 +981,6 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, | |||||||
|         int i, subframe; |         int i, subframe; | ||||||
| 
 | 
 | ||||||
|         p->cur_frame_mode = unpack_bitstream(p, buf, buf_size); |         p->cur_frame_mode = unpack_bitstream(p, buf, buf_size); | ||||||
|         channel_size = frame_sizes_nb[p->cur_frame_mode] + 1; // +7 for rounding and +8 for TOC
 |  | ||||||
|         if (p->cur_frame_mode == NO_DATA) { |         if (p->cur_frame_mode == NO_DATA) { | ||||||
|             av_log(avctx, AV_LOG_ERROR, "Corrupt bitstream\n"); |             av_log(avctx, AV_LOG_ERROR, "Corrupt bitstream\n"); | ||||||
|             return AVERROR_INVALIDDATA; |             return AVERROR_INVALIDDATA; | ||||||
| @ -992,6 +991,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, | |||||||
|             return AVERROR_PATCHWELCOME; |             return AVERROR_PATCHWELCOME; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         channel_size = frame_sizes_nb[p->cur_frame_mode] + 1; // +7 for rounding and +8 for TOC
 | ||||||
|         if (p->cur_frame_mode == MODE_12k2) { |         if (p->cur_frame_mode == MODE_12k2) { | ||||||
|             lsf2lsp_5(p); |             lsf2lsp_5(p); | ||||||
|         } else |         } else | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user