summaryrefslogtreecommitdiff
path: root/apps/codecs/libtremor/synthesis.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libtremor/synthesis.c')
-rw-r--r--apps/codecs/libtremor/synthesis.c18
1 files changed, 13 insertions, 5 deletions
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 @@
28static ogg_int32_t *ipcm_vect[CHANNELS] IBSS_ATTR; 28static ogg_int32_t *ipcm_vect[CHANNELS] IBSS_ATTR;
29 29
30static inline int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){ 30static inline int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){
31 vorbis_dsp_state *vd=vb->vd; 31 vorbis_dsp_state *vd= vb ? vb->vd : 0;
32 private_state *b=(private_state *)vd->backend_state; 32 private_state *b= vd ? (private_state *)vd->backend_state: 0;
33 vorbis_info *vi=vd->vi; 33 vorbis_info *vi= vd ? vd->vi : 0;
34 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; 34 codec_setup_info *ci= vi ? (codec_setup_info *)vi->codec_setup : 0;
35 oggpack_buffer *opb=&vb->opb; 35 oggpack_buffer *opb=vb ? &vb->opb : 0;
36 int type,mode,i; 36 int type,mode,i;
37 37
38 if (!vd || !b || !vi || !ci || !opb) {
39 return OV_EBADPACKET;
40 }
41
38 /* first things first. Make sure decode is ready */ 42 /* first things first. Make sure decode is ready */
39 _vorbis_block_ripcord(vb); 43 _vorbis_block_ripcord(vb);
40 oggpack_readinit(opb,op->packet,op->bytes); 44 oggpack_readinit(opb,op->packet,op->bytes);
@@ -50,6 +54,10 @@ static inline int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep
50 if(mode==-1)return(OV_EBADPACKET); 54 if(mode==-1)return(OV_EBADPACKET);
51 55
52 vb->mode=mode; 56 vb->mode=mode;
57 if(!ci->mode_param[mode]){
58 return(OV_EBADPACKET);
59 }
60
53 vb->W=ci->mode_param[mode]->blockflag; 61 vb->W=ci->mode_param[mode]->blockflag;
54 if(vb->W){ 62 if(vb->W){
55 vb->lW=oggpack_read(opb,1); 63 vb->lW=oggpack_read(opb,1);