summaryrefslogtreecommitdiffstats
path: root/libaf/af.c
diff options
context:
space:
mode:
authormplayer-svn <svn@mplayerhq.hu>2011-11-11 17:15:13 +0000
committerwm4 <wm4@nowhere>2012-08-03 01:33:37 +0200
commite687d1e51acd1215a460c55a17c8861b9aa7008f (patch)
treea5b293c2bc652f81a682ea1c7185ccefab648f0c /libaf/af.c
parent595928542a51269e0bf34bdf8bef5392db099c72 (diff)
downloadmpv-e687d1e51acd1215a460c55a17c8861b9aa7008f.tar.bz2
mpv-e687d1e51acd1215a460c55a17c8861b9aa7008f.tar.xz
af: fix crash on invalid channel count
Sanitize channel count for libaf to avoid crashes since it is used unchecked. af_downmix is an example of a function that can/will crash for invalid values. 0 is not invalid since it is used as "autodetect" for output. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34342 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar
Diffstat (limited to 'libaf/af.c')
-rw-r--r--libaf/af.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libaf/af.c b/libaf/af.c
index 0bc783e49c..bc7a92a56b 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -694,5 +694,9 @@ void af_help (void) {
void af_fix_parameters(af_data_t *data)
{
+ if (data->nch < 0 || data->nch > AF_NCH) {
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "Invalid number of channels %i, assuming 2.\n", data->nch);
+ data->nch = 2;
+ }
data->bps = af_fmt2bits(data->format)/8;
}