[FFmpeg-cvslog] avcodec/utils: Check that the sample rate is not negative when opening an encoder

Michael Niedermayer git at videolan.org
Mon Jul 13 03:52:00 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jul 13 03:40:25 2015 +0200| [10d7d0880cd849caa81a872d2e01948ef7369485] | committer: Michael Niedermayer

avcodec/utils: Check that the sample rate is not negative when opening an encoder

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/utils.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f3449031..0701786 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1576,6 +1576,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
                 goto free_and_end;
             }
         }
+        if (avctx->sample_rate < 0) {
+            av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n",
+                    avctx->sample_rate);
+            ret = AVERROR(EINVAL);
+            goto free_and_end;
+        }
         if (avctx->codec->channel_layouts) {
             if (!avctx->channel_layout) {
                 av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n");



More information about the ffmpeg-cvslog mailing list