--- src/in_vorbis.c.orig	Mon Mar 22 04:13:13 2004
+++ src/in_vorbis.c	Fri Sep  7 19:18:46 2007
@@ -44,7 +44,7 @@ typedef struct {
 } ices_vorbis_in_t;
 
 /* -- static prototypes -- */
-static int ices_vorbis_readpcm (input_stream_t* self, size_t len,
+static ssize_t ices_vorbis_readpcm (input_stream_t* self, size_t len,
 				int16_t* left, int16_t* right);
 static int ices_vorbis_close (input_stream_t* self);
 static void in_vorbis_parse (input_stream_t* self);
@@ -133,13 +133,13 @@ ices_vorbis_open (input_stream_t* self, char* buf, siz
   return 0;
 }
 
-static int
+static ssize_t
 ices_vorbis_readpcm (input_stream_t* self, size_t olen, int16_t* left,
 		     int16_t* right)
 {
   ices_vorbis_in_t* vorbis_data = (ices_vorbis_in_t*) self->data;
   int link;
-  int len;
+  ssize_t len;
   int i;
 
   /* refill buffer if necessary */
@@ -150,6 +150,9 @@ ices_vorbis_readpcm (input_stream_t* self, size_t olen
 			  sizeof (vorbis_data->buf), ICES_OV_BE, SAMPLESIZE, 1, &link)) <= 0) {
 	if (len == OV_HOLE) {
 	  ices_log_error ("Skipping bad vorbis data");
+	} else if (len < 0) {
+	  ices_log_error ("ov_read returned an error: %d", len);
+	  return 0;
 	} else
 	  return len;
       }
