diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-06-15 20:59:22 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-06-16 21:45:45 +0200 |
commit | 5b76c82fd7a5f4f36bb901b8c43d7f7319599599 (patch) | |
tree | 5aac6f119a71b80d2d369be7c24c27b177fe85b2 /libavformat/matroskadec.c | |
parent | e0dac40306928bf544a34f4054504654e8f374d0 (diff) | |
download | ffmpeg-5b76c82fd7a5f4f36bb901b8c43d7f7319599599.tar.gz |
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>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 3512f0f8c8..81dd53fc24 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1680,6 +1680,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; |