Fix crash if speex_packet_to_header fails.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30883 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-03-12 17:29:48 +00:00
parent e0c5806d44
commit fdd4ddccd4
1 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,10 @@ static int init(sh_audio_t *sh) {
return 0; return 0;
} }
ctx->hdr = speex_packet_to_header((char *)&sh->wf[1], sh->wf->cbSize); 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) { if (ctx->hdr->nb_channels != 1 && ctx->hdr->nb_channels != 2) {
mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of channels (%i), " mp_msg(MSGT_DECAUDIO, MSGL_WARN, "Invalid number of channels (%i), "
"assuming mono\n", ctx->hdr->nb_channels); "assuming mono\n", ctx->hdr->nb_channels);