Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address issue #44 #45

Merged
merged 4 commits into from
Mar 2, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ fn floor_zero_decode(rdr :&mut BitpackCursor, codebooks :&[Codebook],
// Undecodable per spec
None => try!(Err(FloorSpecialCase::PacketUndecodable)),
Some(codebook_idx) => {
if *codebook_idx as usize >= (&codebooks).len() {
return Err(FloorSpecialCase::PacketUndecodable)
}
let mut coefficients = Vec::with_capacity(fl.floor0_order as usize);
let mut last = 0.0;
let codebook = &codebooks[*codebook_idx as usize];
Expand Down Expand Up @@ -716,7 +719,7 @@ fn residue_packet_decode_inner(rdr :&mut BitpackCursor, cur_blocksize :u16,
}


// Ok means "fine" (or end of packet, but thats "fine" too!),
// Ok means "fine" (or end of packet, but that's "fine" too!),
// Err means "not fine" -- the whole packet must be discarded
fn residue_packet_decode(rdr :&mut BitpackCursor, cur_blocksize :u16,
do_not_decode_flag :&[bool], resid :&Residue, codebooks :&[Codebook]) -> Result<Vec<f32>, ()> {
Expand Down