From c0e3e1628575647ec9083fd23c26de85ea8f86c0 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Wed, 8 Dec 2010 16:07:46 +0000 Subject: libtremor: merge upstream revision 17528-17530, more error checking and bug fixes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28768 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libtremor/synthesis.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'apps/codecs/libtremor/synthesis.c') diff --git a/apps/codecs/libtremor/synthesis.c b/apps/codecs/libtremor/synthesis.c index c47f381592..657aa74e11 100644 --- a/apps/codecs/libtremor/synthesis.c +++ b/apps/codecs/libtremor/synthesis.c @@ -28,13 +28,17 @@ static ogg_int32_t *ipcm_vect[CHANNELS] IBSS_ATTR; static inline int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){ - vorbis_dsp_state *vd=vb->vd; - private_state *b=(private_state *)vd->backend_state; - vorbis_info *vi=vd->vi; - codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; - oggpack_buffer *opb=&vb->opb; + vorbis_dsp_state *vd= vb ? vb->vd : 0; + private_state *b= vd ? (private_state *)vd->backend_state: 0; + vorbis_info *vi= vd ? vd->vi : 0; + codec_setup_info *ci= vi ? (codec_setup_info *)vi->codec_setup : 0; + oggpack_buffer *opb=vb ? &vb->opb : 0; int type,mode,i; + if (!vd || !b || !vi || !ci || !opb) { + return OV_EBADPACKET; + } + /* first things first. Make sure decode is ready */ _vorbis_block_ripcord(vb); oggpack_readinit(opb,op->packet,op->bytes); @@ -50,6 +54,10 @@ static inline int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep if(mode==-1)return(OV_EBADPACKET); vb->mode=mode; + if(!ci->mode_param[mode]){ + return(OV_EBADPACKET); + } + vb->W=ci->mode_param[mode]->blockflag; if(vb->W){ vb->lW=oggpack_read(opb,1); -- cgit v1.2.3