Port opus-tools check to see if underlying file was overwritten.
authorThomas Daede <daede003@umn.edu>
Mon, 28 Jan 2019 23:33:32 +0000 (15:33 -0800)
committerThomas Daede <daede003@umn.edu>
Mon, 28 Jan 2019 23:33:32 +0000 (15:33 -0800)
lib/vorbisfile.c

index 831cb39..6b7bbee 100644 (file)
@@ -264,6 +264,10 @@ static ogg_int64_t _get_prev_page_serial(OggVorbis_File *vf, ogg_int64_t begin,
         }
       }
     }
+    /*We started from the beginning of the stream and found nothing.
+      This should be impossible unless the contents of the stream changed out
+      from under us after we read from it.*/
+    if(!begin&&vf->offset<0)return OV_EBADLINK;
   }
 
   /* we're not interested in the page... just the serialno and granpos. */