[xiph-commits] r17529 - trunk/Tremor

tterribe at svn.xiph.org tterribe at svn.xiph.org
Wed Oct 13 18:23:28 PDT 2010


Author: tterribe
Date: 2010-10-13 18:23:28 -0700 (Wed, 13 Oct 2010)
New Revision: 17529

Modified:
   trunk/Tremor/synthesis.c
Log:
Port r17027 from libvorbis.

Apply patches from Trac #1638, additional application hardening.


Modified: trunk/Tremor/synthesis.c
===================================================================
--- trunk/Tremor/synthesis.c	2010-10-14 01:17:08 UTC (rev 17528)
+++ trunk/Tremor/synthesis.c	2010-10-14 01:23:28 UTC (rev 17529)
@@ -25,13 +25,17 @@
 #include "block.h"
 
 static 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);
@@ -47,6 +51,10 @@
   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);



More information about the commits mailing list