[xiph-commits] r14601 - trunk/vorbose/src

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Mar 18 10:58:45 PDT 2008


Author: xiphmont
Date: 2008-03-18 10:58:44 -0700 (Tue, 18 Mar 2008)
New Revision: 14601

Modified:
   trunk/vorbose/src/codebook.c
Log:
Continue adding hardening/debugging messages to Vorbose.


Modified: trunk/vorbose/src/codebook.c
===================================================================
--- trunk/vorbose/src/codebook.c	2008-03-18 17:41:06 UTC (rev 14600)
+++ trunk/vorbose/src/codebook.c	2008-03-18 17:58:44 UTC (rev 14601)
@@ -249,7 +249,7 @@
     }
     break;
   default:
-    if(codebook_p)
+    if(warn_p || codebook_p || headerinfo_p)
       printf("WARN codebk: Illegal entry encoding %lu.  Codebook is corrupt.\n",
 	     ret);
     /* EOF */
@@ -259,13 +259,25 @@
   if(codebook_p)
     printf("             Dims           : %d\n",s->dim);
 
+  if(s->dim==0 && (warn_p || codebook_p || headerinfo_p))
+    printf("WARN codebk: Codebook has dimension of zero.\n"
+	   "             Not illegal but probably not correct.\n");
+
+  if(s->entries==0 && (warn_p || codebook_p || headerinfo_p))
+    printf("WARN codebk: Codebook has zero entries.  Not illegal\n"
+	   "             but probably not correct.\n");
+
+  if(s->used_entries==0 && (warn_p || codebook_p || headerinfo_p))
+    printf("WARN codebk: Codebook has zero used entries.  Not \n"
+	   "             illegal but probably not correct.\n");
+
   /* Do we have a mapping to unpack? */
   ogg2pack_read(opb,4,&maptype);
   if(maptype>0){
     unsigned long q_min,q_del,q_bits,q_seq;
 
     if(maptype==1){
-      quantvals=_book_maptype1_quantvals(s);
+      quantvals=(s->dim==0?0:_book_maptype1_quantvals(s));
     }else{
       quantvals=s->entries*s->dim;
     }



More information about the commits mailing list