mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-24 08:48:37 +00:00
avformat/matroskadec: Check audio.sub_packet_h * audio.frame_size
Reject block_align larger than the sub_packet_h * frame_size buffer to avoid a heap out-of-bounds write when deinterleaving RealAudio subpackets. (cherry picked from commit 20fc83fa5b... adapted to 4.4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -2708,6 +2708,10 @@ static int matroska_parse_tracks(AVFormatContext *s)
|
||||
st->codecpar->block_align = track->audio.sub_packet_size;
|
||||
extradata_offset = 78;
|
||||
}
|
||||
if (st->codecpar->block_align <= 0 ||
|
||||
track->audio.sub_packet_h * (unsigned)track->audio.frame_size > INT_MAX ||
|
||||
track->audio.frame_size * track->audio.sub_packet_h < st->codecpar->block_align)
|
||||
return AVERROR_INVALIDDATA;
|
||||
track->audio.buf = av_malloc_array(track->audio.sub_packet_h,
|
||||
track->audio.frame_size);
|
||||
if (!track->audio.buf)
|
||||
|
||||
Reference in New Issue
Block a user