aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-06-15 20:59:22 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-28 02:42:14 +0200
commita5bc5dd49ae1ed29489f9c8ba88387322c376bf1 (patch)
tree4a7e4a2c6516dcb0f5756ad56b8fc8cd81d5d2bd
parent5464da89056698856d919585256bb422558eb554 (diff)
downloadffmpeg-a5bc5dd49ae1ed29489f9c8ba88387322c376bf1.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> (cherry picked from commit 5b76c82fd7a5f4f36bb901b8c43d7f7319599599) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/matroskadec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 0654b31ee4..120a554d20 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1604,6 +1604,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;