Guard against getting an invalid LSP codebook in decode if the packet
authorMonty <xiphmont@xiph.org>
Sat, 10 Feb 2001 02:06:59 +0000 (02:06 +0000)
committerMonty <xiphmont@xiph.org>
Sat, 10 Feb 2001 02:06:59 +0000 (02:06 +0000)
is corrupt.

Monty

svn path=/trunk/vorbis/; revision=1252

lib/floor0.c

index 9d03763..daf1cab 100644 (file)
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.36 2001/02/02 03:51:56 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.37 2001/02/10 02:06:59 xiphmont Exp $
 
  ********************************************************************/
 
@@ -398,7 +398,7 @@ static int floor0_inverse(vorbis_block *vb,vorbis_look_floor *i,float *out){
     int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
     float *lsp=alloca(sizeof(float)*look->m);
 
-    if(booknum!=-1){
+    if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
       backend_lookup_state *be=vb->vd->backend_state;
       codebook *b=be->fullbooks+info->books[booknum];
       float last=0.f;