[FFmpeg-cvslog] swresample/swresample: check for invalid sample rates

Paul B Mahol git at videolan.org
Sun May 26 15:44:19 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri May 24 18:04:50 2019 +0200| [a9fa6b8e025cd138f8c3ed4cfa6d568bd79d0123] | committer: Paul B Mahol

swresample/swresample: check for invalid sample rates

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

 libswresample/swresample.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 6d28e6a798..1ac5ef9a30 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -164,6 +164,14 @@ av_cold int swr_init(struct SwrContext *s){
         return AVERROR(EINVAL);
     }
 
+    if(s-> in_sample_rate <= 0){
+        av_log(s, AV_LOG_ERROR, "Requested input sample rate %d is invalid\n", s->in_sample_rate);
+        return AVERROR(EINVAL);
+    }
+    if(s->out_sample_rate <= 0){
+        av_log(s, AV_LOG_ERROR, "Requested output sample rate %d is invalid\n", s->out_sample_rate);
+        return AVERROR(EINVAL);
+    }
     s->out.ch_count  = s-> user_out_ch_count;
     s-> in.ch_count  = s->  user_in_ch_count;
     s->used_ch_count = s->user_used_ch_count;



More information about the ffmpeg-cvslog mailing list