X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-llaudio%2Fsrc%2Fdemuxers%2Fflac.rs;h=13ab0e37a3193ebe818c5855ad8064009f1a47be;hb=886cde4847280b96e10d240c2f2d76abec121dc8;hp=b941bf4b767f284d02a9cb8e60753ef03c4535a3;hpb=757ee9164bd2ab7e1690ae2ea4e5a03f7b37f1b5;p=nihav.git diff --git a/nihav-llaudio/src/demuxers/flac.rs b/nihav-llaudio/src/demuxers/flac.rs index b941bf4..13ab0e3 100644 --- a/nihav-llaudio/src/demuxers/flac.rs +++ b/nihav-llaudio/src/demuxers/flac.rs @@ -89,7 +89,7 @@ impl<'a> FLACDemuxer<'a> { 1 => 192, 2..=5 => 576 << (bsz_id - 2), 6 => { - validate!(idx + 1 <= buf.len()); + validate!(idx < buf.len()); u64::from(buf[idx]) + 1 }, 7 => { @@ -99,9 +99,9 @@ impl<'a> FLACDemuxer<'a> { _ => 256 << (bsz_id - 8), }; let pts = u64::from(read_utf8(&buf[4..])?); - + validate!(idx < buf.len()); - + (blksamps, pts) }; @@ -286,6 +286,7 @@ mod test { #[test] fn test_flac_demux() { + // sample: https://samples.mplayerhq.hu/A-codecs/lossless/luckynight.flac let mut file = File::open("assets/LLaudio/luckynight.flac").unwrap(); let mut fr = FileReader::new_read(&mut file); let mut br = ByteReader::new(&mut fr);