shithub: opusfile

Download patch

ref: 15193c53bdb121d3e3b9b430ed38364b04013eb0
parent: 4dcf9b0d60aea983bd40995a444109c4ddf2b7d3
author: Timothy B. Terriberry <tterribe@xiph.org>
date: Mon Nov 12 11:58:40 EST 2012

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.

--- a/src/opusfile.c
+++ b/src/opusfile.c
@@ -967,6 +967,8 @@
      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