mirror of
				https://github.com/nyanmisaka/ffmpeg-rockchip.git
				synced 2025-10-31 20:42:49 +08:00 
			
		
		
		
	avformat/rmdec: Check old_format len for overflow
Maybe such large values could be disallowed earlier and closer to where they are set. Fixes: signed integer overflow: 538976288 * 8224 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6704350354341888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
		| @@ -1012,8 +1012,8 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||||
| { | { | ||||||
|     RMDemuxContext *rm = s->priv_data; |     RMDemuxContext *rm = s->priv_data; | ||||||
|     AVStream *st = NULL; // init to silence compiler warning |     AVStream *st = NULL; // init to silence compiler warning | ||||||
|     int i, len, res, seq = 1; |     int i, res, seq = 1; | ||||||
|     int64_t timestamp, pos; |     int64_t timestamp, pos, len; | ||||||
|     int flags; |     int flags; | ||||||
|  |  | ||||||
|     for (;;) { |     for (;;) { | ||||||
| @@ -1032,7 +1032,9 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||||
|                 ast = st->priv_data; |                 ast = st->priv_data; | ||||||
|                 timestamp = AV_NOPTS_VALUE; |                 timestamp = AV_NOPTS_VALUE; | ||||||
|                 len = !ast->audio_framesize ? RAW_PACKET_SIZE : |                 len = !ast->audio_framesize ? RAW_PACKET_SIZE : | ||||||
|                     ast->coded_framesize * ast->sub_packet_h / 2; |                     ast->coded_framesize * (int64_t)ast->sub_packet_h / 2; | ||||||
|  |                 if (len > INT_MAX) | ||||||
|  |                     return AVERROR_INVALIDDATA; | ||||||
|                 flags = (seq++ == 1) ? 2 : 0; |                 flags = (seq++ == 1) ? 2 : 0; | ||||||
|                 pos = avio_tell(s->pb); |                 pos = avio_tell(s->pb); | ||||||
|             } else { |             } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Niedermayer
					Michael Niedermayer