From adb2d6e8094f2e173ca979be044c112d271ac883 Mon Sep 17 00:00:00 2001 From: est31 Date: Sun, 3 Mar 2019 16:39:39 +0100 Subject: [PATCH] Address issue #46 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. --- src/audio.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/audio.rs b/src/audio.rs index e625983..7587293 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -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 {