mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-04 18:09:11 +00:00
WAV: Fix potential overflow in bit depth calculation
This commit is contained in:
parent
d6e5553732
commit
f86f1e017a
3 changed files with 7 additions and 1 deletions
|
@ -209,7 +209,7 @@ pub(super) fn read_properties(
|
|||
..
|
||||
}) if valid_bits_per_sample > 0 => bit_depth = valid_bits_per_sample as u8,
|
||||
_ if bits_per_sample > 0 => bit_depth = bits_per_sample as u8,
|
||||
_ => bit_depth = (bytes_per_sample * 8) as u8,
|
||||
_ => bit_depth = bytes_per_sample.saturating_mul(8) as u8,
|
||||
};
|
||||
|
||||
let channel_mask = extensible_info.map(|info| info.channel_mask);
|
||||
|
|
BIN
lofty/tests/fuzz/assets/wavfile_read_from/aa
Normal file
BIN
lofty/tests/fuzz/assets/wavfile_read_from/aa
Normal file
Binary file not shown.
|
@ -28,3 +28,9 @@ fn panic3() {
|
|||
crate::get_reader("wavfile_read_from/2_IDX_34_RAND_128635499166458268533001.wav");
|
||||
let _ = WavFile::read_from(&mut reader, ParseOptions::new());
|
||||
}
|
||||
|
||||
#[test_log::test]
|
||||
fn panic4() {
|
||||
let mut reader = crate::get_reader("wavfile_read_from/aa");
|
||||
let _ = WavFile::read_from(&mut reader, ParseOptions::new());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue