[FFmpeg-cvslog] matroskadec: check audio sample rate

Andreas Cadhalpun git at videolan.org
Mon Jul 20 10:48:21 CEST 2015


ffmpeg | branch: release/2.6 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Mon Jun 15 20:59:22 2015 +0200| [5019f8d10c081c7c19e70b9da4de17d6b694570e] | committer: Michael Niedermayer

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 at gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit 5b76c82fd7a5f4f36bb901b8c43d7f7319599599)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5019f8d10c081c7c19e70b9da4de17d6b694570e
---

 libavformat/matroskadec.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 85e5c8a..114e422 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1660,6 +1660,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;



More information about the ffmpeg-cvslog mailing list