[xiph-commits] r16328 - in trunk/vorbis: examples lib

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Jul 23 18:51:10 PDT 2009


Author: xiphmont
Date: 2009-07-23 18:51:10 -0700 (Thu, 23 Jul 2009)
New Revision: 16328

Modified:
   trunk/vorbis/examples/vorbisfile_example.c
   trunk/vorbis/lib/block.c
Log:
Fix for Trac #1573.

This is two bugs.  The first is that vorbisfile_example.c ignores an
error code and plows ahead blindly if libvorbisfile reports the
current bitstream section is bad (OV_EBADLINK).

The second is that retrying after the error crashes libvorbisfile due
to the unitialized state.



Modified: trunk/vorbis/examples/vorbisfile_example.c
===================================================================
--- trunk/vorbis/examples/vorbisfile_example.c	2009-07-24 00:49:25 UTC (rev 16327)
+++ trunk/vorbis/examples/vorbisfile_example.c	2009-07-24 01:51:10 UTC (rev 16328)
@@ -70,7 +70,12 @@
       /* EOF */
       eof=1;
     } else if (ret < 0) {
-      /* error in the stream.  Not a problem, just reporting it in
+      if(ret==OV_EBADLINK){
+        fprintf(stderr,"Corrupt bitstream section! Exiting.\n");
+        exit(1);
+      }
+
+      /* some other error in the stream.  Not a problem, just reporting it in
          case we (the app) cares.  In this case, we don't. */
     } else {
       /* we don't bother dealing with sample rate changes, etc, but

Modified: trunk/vorbis/lib/block.c
===================================================================
--- trunk/vorbis/lib/block.c	2009-07-24 00:49:25 UTC (rev 16327)
+++ trunk/vorbis/lib/block.c	2009-07-24 01:51:10 UTC (rev 16328)
@@ -232,9 +232,10 @@
     v->analysisp=1;
   }else{
     /* finish the codebooks */
-    if(!ci->fullbooks){
+    if(!ci->fullbooks)
       ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
-      for(i=0;i<ci->books;i++){
+    for(i=0;i<ci->books;i++){
+      if(ci->book_param[i]!=NULL){
         if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
           return -1;
         /* decode codebooks are now standalone after init */



More information about the commits mailing list