Vorbis: Fix panic with zero-length property reads

closes #342
This commit is contained in:
Serial 2024-04-03 12:36:06 -04:00 committed by Alex
parent a54861b02c
commit 1b8b519543
2 changed files with 7 additions and 1 deletions

View file

@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- **Vorbis**: Fix panic when reading properties of zero-length files ([issue](https://github.com/Serial-ATA/lofty-rs/issues/342)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/365))
## [0.18.2] - 2024-01-23
### Fixed

View file

@ -137,8 +137,11 @@ where
}
}
if properties.bitrate_nominal > 0 {
if length > 0 {
properties.overall_bitrate = (file_length.saturating_mul(8) / length) as u32;
}
if properties.bitrate_nominal > 0 {
properties.audio_bitrate = (properties.bitrate_nominal as u64 / 1000) as u32;
}