From 603cd941ea32576bdbca33c9d5625d878cd0d1c9 Mon Sep 17 00:00:00 2001 From: Thomas Daede Date: Mon, 28 Jan 2019 15:33:32 -0800 Subject: [PATCH] Port opus-tools check to see if underlying file was overwritten. --- lib/vorbisfile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index 831cb39..6b7bbee 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -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. */ -- 2.7.4