Commit 338f8b2e authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/matroskadec: check out_samplerate before using it in av_rescale()

Prevent assertion failure with damaged input
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent af248fa1
...@@ -1737,6 +1737,8 @@ static int matroska_read_header(AVFormatContext *s) ...@@ -1737,6 +1737,8 @@ static int matroska_read_header(AVFormatContext *s)
avio_wl16(&b, 1); avio_wl16(&b, 1);
avio_wl16(&b, track->audio.channels); avio_wl16(&b, track->audio.channels);
avio_wl16(&b, track->audio.bitdepth); avio_wl16(&b, track->audio.bitdepth);
if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX)
return AVERROR_INVALIDDATA;
avio_wl32(&b, track->audio.out_samplerate); avio_wl32(&b, track->audio.out_samplerate);
avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000)); avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000));
} else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 || } else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment