Mercurial > mplayer.hg
changeset 34254:f4c0388ddc74
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.
author | reimar |
---|---|
date | Fri, 11 Nov 2011 17:15:13 +0000 |
parents | c363052bde0b |
children | 1802d9d74c26 |
files | libaf/af.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af.c Thu Nov 10 16:31:07 2011 +0000 +++ b/libaf/af.c Fri Nov 11 17:15:13 2011 +0000 @@ -664,5 +664,9 @@ 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; }