Skip to content

Commit 013b17d

Browse files
committed
Ilst: Ignore invalid covr data types when not strict
1 parent 3d291d1 commit 013b17d

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

CHANGELOG.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2727
- `AtomData::data_type()` to get the data type code of the atom content.
2828

2929
### Changed
30-
- **Ilst**: Add new rules for `gnre` atom upgrades ([issue](https://github.com/Serial-ATA/lofty-rs/issues/409)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/485))
31-
- In the case that a `©gen` and `gnre` atom are present in a file, there was no way to tell which `©gen` atoms were upgraded.
32-
the new rules are:
33-
- `gnre` present + no `©gen` present, `gnre` gets upgraded as normal
34-
- `gnre` present + `©gen` present, `©gen` takes precedence and `gnre` is discarded
35-
- With [ParsingOptions::implicit_conversions](https://docs.rs/lofty/latest/lofty/config/struct.ParseOptions.html#method.implicit_conversions)
36-
set to `false`, `gnre` will be retained as an atom of type `Unknown`.
37-
- **RIFF INFO**: Ignore text decoding errors when not using `ParsingMode::Strict` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/373))
30+
- **Ilst**:
31+
- Add new rules for `gnre` atom upgrades ([issue](https://github.com/Serial-ATA/lofty-rs/issues/409)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/485))
32+
- In the case that a `©gen` and `gnre` atom are present in a file, there was no way to tell which `©gen` atoms were upgraded.
33+
the new rules are:
34+
- `gnre` present + no `©gen` present, `gnre` gets upgraded as normal
35+
- `gnre` present + `©gen` present, `©gen` takes precedence and `gnre` is discarded
36+
- With [ParsingOptions::implicit_conversions](https://docs.rs/lofty/latest/lofty/config/struct.ParseOptions.html#method.implicit_conversions)
37+
set to `false`, `gnre` will be retained as an atom of type `Unknown`.
38+
- Ignore invalid `covr` data types when not using `ParsingMode::Strict` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/482)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/486))
39+
- **RIFF INFO**: Ignore text decoding errors when not using `ParsingMode::Strict` ([issue](https://github.com/Serial-ATA/lofty-rs/issues/373)) ([PR](https://github.com/Serial-ATA/lofty-rs/pull/486))
3840
- RIFF INFO tags may be encoded with a non UTF-8 system encoding, that we have no way of knowing. It's no longer an error to read these files,
3941
it's just unlikely that anything useful come out of the RIFF INFO tags.
4042

lofty/src/mp4/ilst/read.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,17 @@ where
378378
DataType::Jpeg => Some(MimeType::Jpeg),
379379
DataType::Png => Some(MimeType::Png),
380380
DataType::Bmp => Some(MimeType::Bmp),
381-
_ => err!(BadAtom("\"covr\" atom has an unknown type")),
381+
_ => {
382+
if parsing_mode == ParsingMode::Strict {
383+
err!(BadAtom("\"covr\" atom has an unknown type"))
384+
}
385+
386+
log::warn!(
387+
"Encountered \"covr\" atom with an unknown type of `{}`, discarding",
388+
Into::<u32>::into(data_type)
389+
);
390+
return Ok(());
391+
},
382392
};
383393

384394
let picture_data = AtomData::Picture(Picture {

0 commit comments

Comments
 (0)