From 3dc0cfc1fe388468426f12cf8e0ccc1f0220657f Mon Sep 17 00:00:00 2001 From: mplayer-svn Date: Sun, 19 Feb 2012 13:49:04 +0000 Subject: dec_audio: add sanity check against 0 channels Add a safeguard to avoid crash if the decoder e.g. claims 0 channels. That would be a decoder bug, but an extra check can still help. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@34738 b3059339-0415-0410-9bf9-f77b7e298cf2 Author: reimar --- libmpcodecs/dec_audio.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libmpcodecs/dec_audio.c') diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c index 73a78332f8..48526b2390 100644 --- a/libmpcodecs/dec_audio.c +++ b/libmpcodecs/dec_audio.c @@ -409,6 +409,8 @@ int decode_audio(sh_audio_t *sh_audio, struct bstr *outbuf, int minlen) * more space in the output buffer than the minimum length we try to * decode. */ int max_decode_len = sh_audio->a_buffer_size - sh_audio->audio_out_minsize; + if (!unitsize) + return -1; max_decode_len -= max_decode_len % unitsize; while (outbuf->len < minlen) { -- cgit v1.2.3