diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-05-24 18:04:50 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-05-26 14:43:32 +0200 |
commit | a9fa6b8e025cd138f8c3ed4cfa6d568bd79d0123 (patch) | |
tree | 3ff1ff171a918c9ef324019b69c96d57f43c2b80 /libswresample | |
parent | 80757bed89c361fe2dc56eb61f4cb3b9f9b1aedc (diff) | |
download | ffmpeg-a9fa6b8e025cd138f8c3ed4cfa6d568bd79d0123.tar.gz |
swresample/swresample: check for invalid sample rates
Diffstat (limited to 'libswresample')
-rw-r--r-- | libswresample/swresample.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |