mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 20:42:49 +08:00 
			
		
		
		
	Merge commit 'f7c5883126f9440547933eefcf000aa78af4821c'
* commit 'f7c5883126f9440547933eefcf000aa78af4821c':
  alac: Limit max_samples_per_frame
See: 3920d13878
Merged-by: Michael Niedermayer <michaelni@gmx.at>
			
			
This commit is contained in:
		| @@ -511,11 +511,7 @@ static av_cold int alac_decode_close(AVCodecContext *avctx) | |||||||
| static int allocate_buffers(ALACContext *alac) | static int allocate_buffers(ALACContext *alac) | ||||||
| { | { | ||||||
|     int ch; |     int ch; | ||||||
|     int buf_size; |     int buf_size = alac->max_samples_per_frame * sizeof(int32_t); | ||||||
|  |  | ||||||
|     if (alac->max_samples_per_frame > INT_MAX / sizeof(int32_t)) |  | ||||||
|         goto buf_alloc_fail; |  | ||||||
|     buf_size = alac->max_samples_per_frame * sizeof(int32_t); |  | ||||||
|  |  | ||||||
|     for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) { |     for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) { | ||||||
|         FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch], |         FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch], | ||||||
| @@ -546,7 +542,8 @@ static int alac_set_info(ALACContext *alac) | |||||||
|     bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4 |     bytestream2_skipu(&gb, 12); // size:4, alac:4, version:4 | ||||||
|  |  | ||||||
|     alac->max_samples_per_frame = bytestream2_get_be32u(&gb); |     alac->max_samples_per_frame = bytestream2_get_be32u(&gb); | ||||||
|     if (!alac->max_samples_per_frame || alac->max_samples_per_frame > INT_MAX) { |     if (!alac->max_samples_per_frame || | ||||||
|  |         alac->max_samples_per_frame > INT_MAX / sizeof(int32_t)) { | ||||||
|         av_log(alac->avctx, AV_LOG_ERROR, "max samples per frame invalid: %u\n", |         av_log(alac->avctx, AV_LOG_ERROR, "max samples per frame invalid: %u\n", | ||||||
|                alac->max_samples_per_frame); |                alac->max_samples_per_frame); | ||||||
|         return AVERROR_INVALIDDATA; |         return AVERROR_INVALIDDATA; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Niedermayer
					Michael Niedermayer