shithub: sox

Download patch

ref: 81f65dc9aa1c6f8f0dd42906fff33f27e258b0e6
parent: e8c783850229efae0c76d3d22df91b63db3913a0
author: cbagwell <cbagwell>
date: Fri Nov 30 21:10:35 EST 2001

Bug in EOF handling

--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -1,4 +1,3 @@
-#if defined(HAVE_LIBVORBIS)
 /*
  * Ogg Vorbis sound format driver
  * Copyright 2001, Stan Seibert <indigo@aztec.asu.edu>
@@ -17,11 +16,12 @@
  * Lance Norskog And Sundry Contributors are not responsible for 
  * the consequences of using this software.
  */
+#include "st_i.h"
 
+#if defined(HAVE_LIBVORBIS)
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
-#include "st_i.h"
 
 #include <ogg/ogg.h>
 #include <vorbis/codec.h>
@@ -229,11 +229,12 @@
 		{
 			if (vb->eof)
 				break;
-			else
+			ret = refill_buffer(vb);
+			if (ret == BUF_EOF || ret == BUF_ERROR)
 			{
-				ret = refill_buffer(vb);
-				if (ret == BUF_EOF || ret == BUF_ERROR)
-					vb->eof = 1;
+			    vb->eof = 1;
+			    if (vb->end == 0)
+				break;
 			}
 		}