From f9cede213bdd679e9e42feaa8b8f7505403a1eb2 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 13 Aug 2020 15:09:14 +0100 Subject: [PATCH] Fixed bug when seeking to pos < dataoffset --- lib/vorbisfile.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c index 9219c2f2d..e133e5526 100644 --- a/lib/vorbisfile.c +++ b/lib/vorbisfile.c @@ -1441,7 +1441,10 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){ int got_page=0; ogg_page og; - + + if (pos < begin) begin = pos; + ogg_int64_t initialBegin = begin; + /* if we have only one page, there will be no bisection. Grab the page here */ if(begin==end){ result=_seek_helper(vf,begin); @@ -1560,7 +1563,7 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){ first PCM granule position fencepost. */ if(got_page && - begin == vf->dataoffsets[link] && + begin == initialBegin && ogg_page_serialno(&og)==vf->serialnos[link]){ /* Yes, this is the beginning-of-stream case. We already have