From e687d1e51acd1215a460c55a17c8861b9aa7008f Mon Sep 17 00:00:00 2001 From: mplayer-svn Date: Fri, 11 Nov 2011 17:15:13 +0000 Subject: 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 --- libaf/af.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libaf/af.c') 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; } -- cgit v1.2.3