1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

matroskadec: check audio sample rate

And default to 8000 if it is invalid.

An invalid sample rate can trigger av_assert2 in av_rescale_rnd.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 5b76c82fd7)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
Andreas Cadhalpun 2015-06-15 20:59:22 +02:00
parent 7cbceb16ad
commit d89cd16afa

View File

@ -1668,6 +1668,14 @@ static int matroska_parse_tracks(AVFormatContext *s)
if (!track->codec_id)
continue;
if (track->audio.samplerate < 0 || track->audio.samplerate > INT_MAX ||
isnan(track->audio.samplerate)) {
av_log(matroska->ctx, AV_LOG_WARNING,
"Invalid sample rate %f, defaulting to 8000 instead.\n",
track->audio.samplerate);
track->audio.samplerate = 8000;
}
if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
if (!track->default_duration && track->video.frame_rate > 0)
track->default_duration = 1000000000 / track->video.frame_rate;