Skip to content

Commit

Permalink
Address issue at RustAudio#44
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSandeen committed Mar 1, 2019
1 parent 0d13bc4 commit 86bf2b7
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 86bf2b7

Please sign in to comment.