Skip to content
Snippets Groups Projects
Commit 729c88e7 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry
Browse files

Fix an incorrect assertion in op_pcm_seek_page().

When we were checking the current file offset to see if we should
 use it as the starting bisection point, we assumed that offset was
 larger than the start of the data range for that link (and
 consequently, inside the bisection range).
If there is a random page earlier in the file that happens to use
 the same serial number as a link we identified later in the file
 at file open time, and we had stopped reading there before the
 seek, then this assumption might not be true.

Ironically, it was not the case that contained the assertion that
 had trouble with such an offset.
It would fail the check that we were cutting off more than half the
 range, since we were actually cutting off a negative amount, and
 fall back to the midpoint of the link as the first bisection
 point.
However, the case below that (where the target comes after the
 current timestamp), we might have erroneously cut off the entire
 range (setting end to offset, which was less than begin), causing
 the seek to immediately fail.

Instead, validate the curent offset against both ends of the link
 before attempting to use it as the initial bisection point.
Thanks to Felicia Lim for the report.

Fixes #2331
parent 82adfb61
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment