changeset 32619:34c4e6ff7b17

Fix ad_faad crash when used on an empty audio stream.
author reimar
date Sun, 12 Dec 2010 13:56:35 +0000
parents de37221dff02
children 231764e0b755
files libmpcodecs/ad_faad.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_faad.c	Sun Dec 12 12:51:32 2010 +0000
+++ b/libmpcodecs/ad_faad.c	Sun Dec 12 13:56:35 2010 +0000
@@ -127,6 +127,11 @@
     faacDecSetConfiguration(faac_hdec, faac_conf);
 
     sh->a_in_buffer_len = demux_read_data(sh->ds, sh->a_in_buffer, sh->a_in_buffer_size);
+    if (!sh->a_in_buffer_len) {
+      // faad init will crash with 0 buffer length
+      mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Could not get audio data!\n");
+      return 0;
+    }
 #if CONFIG_FAAD_INTERNAL
     /* init the codec, look for LATM */
     faac_init = faacDecInit(faac_hdec, sh->a_in_buffer,