changeset 30841:a1bf34d75484

Fix crash if speex_packet_to_header fails.
author reimar
date Fri, 12 Mar 2010 17:29:48 +0000
parents e159f9aa13a2
children 482aa22c785e
files libmpcodecs/ad_speex.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_speex.c	Fri Mar 12 17:21:05 2010 +0000
+++ b/libmpcodecs/ad_speex.c	Fri Mar 12 17:29:48 2010 +0000
@@ -61,6 +61,10 @@
     return 0;
   }
   ctx->hdr = speex_packet_to_header((char *)&sh->wf[1], sh->wf->cbSize);
+  if (!ctx->hdr) {
+    mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Invalid extradata!\n");
+    return 0;
+  }
   if (ctx->hdr->nb_channels != 1 && ctx->hdr->nb_channels != 2) {
     mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of channels (%i), "
             "assuming mono\n", ctx->hdr->nb_channels);