For the first time it founds O, self.cpt_of is updated to 1. Right after that, it founds the second O, but the first match arrow does not match because of already-updated self.cpt_of, and self.cpt_of is brought back to 0. As a result, the function cannot find the OggS magic. This case also happens in OgOggs and OggOggs. It's extremely rare for such case to happen, though.
This can be fixed by removing if self.cpt_of == 0 guard in line 565.
It's very nitpicking, but I think current
check_arr
may overlook theOggS
header when there is anO
right beforeOggS
.https://github.com/RustAudio/ogg/blob/master/src/reading.rs#L562-L572
For the first time it founds
O
,self.cpt_of
is updated to 1. Right after that, it founds the secondO
, but the first match arrow does not match because of already-updatedself.cpt_of
, andself.cpt_of
is brought back to0
. As a result, the function cannot find theOggS
magic. This case also happens inOgOggs
andOggOggs
. It's extremely rare for such case to happen, though.This can be fixed by removing
if self.cpt_of == 0
guard in line 565.