changeset 34650:dc78fbe1f17f

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.
author reimar
date Sun, 19 Feb 2012 13:49:04 +0000
parents 6dcc91eb3cf8
children e4de3e6665ae
files libmpcodecs/dec_audio.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_audio.c	Sun Feb 19 13:39:16 2012 +0000
+++ b/libmpcodecs/dec_audio.c	Sun Feb 19 13:49:04 2012 +0000
@@ -449,6 +449,8 @@
      * 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 (sh_audio->a_out_buffer_len < minlen) {