mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 05:32:38 +00:00
WV: Don't allow zero-size blocks
This commit is contained in:
parent
be31f7f0a5
commit
8ad3aebfbc
3 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
BIN
lofty/tests/fuzz/assets/wavpackfile_read_from/bb
Normal file
BIN
lofty/tests/fuzz/assets/wavpackfile_read_from/bb
Normal file
Binary file not shown.
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue