From 15193c53bdb121d3e3b9b430ed38364b04013eb0 Mon Sep 17 00:00:00 2001 From: "Timothy B. Terriberry" <tterribe@xiph.org> Date: Mon, 12 Nov 2012 16:58:40 -0800 Subject: [PATCH] Check for end_offset < data_offset. I don't think it actually breaks anything if we don't (seeking will fail, but it will fail cleanly). However, it _is_ an indication that the file data changed out from under us (or of another library bug), so we should fail fast. --- src/opusfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opusfile.c b/src/opusfile.c index bae8d3d..31d013a 100644 --- a/src/opusfile.c +++ b/src/opusfile.c @@ -967,6 +967,8 @@ static int op_find_final_pcm_offset(OggOpusFile *_of, cur_serialno,_serialnos,_nserialnos); if(OP_UNLIKELY(_offset<0))return (int)_offset; } + /*At worst we should have found the first page with completed packets.*/ + if(OP_UNLIKELY(_offset<_link->data_offset))return OP_EBADLINK; /*This implementation requires that the difference between the first and last granule positions in each link be representable in a signed, 64-bit number, and that each link also have at least as many samples as the -- GitLab