summaryrefslogtreecommitdiffstats
path: root/libswresample
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-01 01:39:17 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-01 01:39:17 +0200
commit834b3760a7ca112573e813bd6c3573a8c0daf4ed (patch)
treecb03553525e3def396dced4eef8c182f2962d6eb /libswresample
parent2a93f28a4b6eef8b93046e0b4e3225f2ff1e7324 (diff)
downloadffmpeg-streaming-834b3760a7ca112573e813bd6c3573a8c0daf4ed.zip
ffmpeg-streaming-834b3760a7ca112573e813bd6c3573a8c0daf4ed.tar.gz
swresample: check for invalid sample formats.
Bug-Found-by: Justin Ruggles Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/swresample.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 519cadf..7276c7a 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -144,7 +144,15 @@ int swr_init(SwrContext *s){
s-> in_sample_fmt &= 0xFF;
s->out_sample_fmt &= 0xFF;
- //We assume AVOptions checked the various values and the defaults where allowed
+ if(s-> in_sample_fmt >= AV_SAMPLE_FMT_NB){
+ av_log(s, AV_LOG_ERROR, "Requested sample format %s is invalid\n", av_get_sample_fmt_name(s->in_sample_fmt));
+ return AVERROR(EINVAL);
+ }
+ if(s->out_sample_fmt >= AV_SAMPLE_FMT_NB){
+ av_log(s, AV_LOG_ERROR, "Requested sample format %s is invalid\n", av_get_sample_fmt_name(s->out_sample_fmt));
+ return AVERROR(EINVAL);
+ }
+
if( s->int_sample_fmt != AV_SAMPLE_FMT_S16
&&s->int_sample_fmt != AV_SAMPLE_FMT_FLT){
av_log(s, AV_LOG_ERROR, "Requested sample format %s is not supported internally, only float & S16 is supported\n", av_get_sample_fmt_name(s->int_sample_fmt));
OpenPOWER on IntegriCloud