Skip to content

Commit

Permalink
Address issue #46
Browse files Browse the repository at this point in the history
The infinite loop is caused by classwords_per_codeword
being zero, which makes partition_count never increase
so the while partition_count < partitions_to_read loop
never terminates.
  • Loading branch information
est31 committed Mar 3, 2019
1 parent ce95199 commit adb2d6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,12 @@ fn residue_packet_decode_inner(rdr :&mut BitpackCursor, cur_blocksize :u16,
return Ok(vectors);
}

if classwords_per_codeword == 0 {
// A value of 0 would create an infinite loop.
// Therefore, throw an error in this case.
try!(Err(()));
}

'pseudo_return: loop {
// ENdofpacketisnOrmal macro. Local replacement for try.
macro_rules! eno {
Expand Down

0 comments on commit adb2d6e

Please sign in to comment.