WV: Don't allow zero-size blocks

This commit is contained in:
Serial 2024-10-29 20:46:05 -04:00 committed by Alex
parent be31f7f0a5
commit 8ad3aebfbc
3 changed files with 10 additions and 0 deletions

View file

@ -322,6 +322,10 @@ fn get_extended_meta_info(
index += 2;
}
if size == 0 {
decode_err!(@BAIL WavPack, "Encountered a zero-sized block");
}
if id & ID_FLAG_ODD_SIZE > 0 {
size -= 1;
}

Binary file not shown.

View file

@ -90,3 +90,9 @@ fn panic1() {
let mut reader = crate::get_reader("wavpackfile_read_from/output");
let _ = WavPackFile::read_from(&mut reader, ParseOptions::default());
}
#[test_log::test]
fn panic2() {
let mut reader = crate::get_reader("wavpackfile_read_from/bb");
let _ = WavPackFile::read_from(&mut reader, ParseOptions::default());
}