Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MP4: Prevent the storage of empty atoms #85

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- **ID3v2**: The `'/'` character is no longer used as a separator ([issue](https://github.com/Serial-ATA/lofty-rs/issues/82))
- **MP4**: Empty atoms were able to pass through and get stored, causing a panic in the `Ilst` -> `Tag` conversion ([issue](https://github.com/Serial-ATA/lofty-rs/issues/84))

## [0.9.0] - 2022-10-30

Expand Down
5 changes: 5 additions & 0 deletions src/mp4/ilst/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ where
R: Read + Seek,
{
if let Some(mut atom_data) = parse_data_inner(reader, &atom_info)? {
// No need to store empty atoms
if atom_data.is_empty() {
return Ok(());
}

// Most atoms we encounter are only going to have 1 value, so store them as such
if atom_data.len() == 1 {
let (flags, content) = atom_data.remove(0);
Expand Down