Skip to content
  • Timothy B. Terriberry's avatar
    Fix handling of holes again. · 85f7aa22
    Timothy B. Terriberry authored
    It is possible for us to buffer multiple out-of-sequence pages with no packets
     on them before getting one that does have packets.
    In this case, libogg will report each hole in the page sequence numbers
     separately.
    Since we were only checking for the actual packets once after encountering a
     hole, if the total number of holes was even, we could exit
     op_fetch_and_process_page() with valid packets still in the libogg buffer.
    Then, if the next page had a lot of packets, we might wind up with a total of
     more than 255 of them, overflowing our stack buffer for their durations.
    That's bad.
    
    Instead, make sure we always drain all hole reports from libogg any time we
     encounter one, to ensure we get the actual packets behind it.
    
    Thanks to Felicia Lim for the report.
    85f7aa22