summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authormplayer-svn <svn@mplayerhq.hu>2012-02-19 13:49:04 +0000
committerwm4 <wm4@nowhere>2012-08-03 01:47:47 +0200
commit3dc0cfc1fe388468426f12cf8e0ccc1f0220657f (patch)
tree2a2c87ec7ce7140e3386e92c633b6d1d2b9792c8 /libmpcodecs
parent3fa539c4e2c03d0db082424be1743def87c75543 (diff)
downloadmpv-3dc0cfc1fe388468426f12cf8e0ccc1f0220657f.tar.bz2
mpv-3dc0cfc1fe388468426f12cf8e0ccc1f0220657f.tar.xz
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
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/dec_audio.c2
1 files changed, 2 insertions, 0 deletions
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) {