Don't allow writing an ID3v2 footer in WAV/AIFF

This commit is contained in:
Serial 2022-02-19 10:42:18 -05:00
parent e01d875e05
commit 99d4bdc9c2
No known key found for this signature in database
GPG key ID: DA95198DC17C4568

View file

@ -29,10 +29,12 @@ pub(crate) fn write_id3v2<'a, I: Iterator<Item = FrameRef<'a>> + 'a>(
Some(FileType::APE | FileType::MP3) => {},
// Formats such as WAV and AIFF store the ID3v2 tag in an 'ID3 ' chunk rather than at the beginning of the file
Some(FileType::WAV) => {
return chunk_file::write_to_chunk_file::<LittleEndian>(data, &create_tag(tag)?)
tag.flags.footer = false;
return chunk_file::write_to_chunk_file::<LittleEndian>(data, &create_tag(tag)?);
},
Some(FileType::AIFF) => {
return chunk_file::write_to_chunk_file::<BigEndian>(data, &create_tag(tag)?)
tag.flags.footer = false;
return chunk_file::write_to_chunk_file::<BigEndian>(data, &create_tag(tag)?);
},
_ => return Err(LoftyError::new(ErrorKind::UnsupportedTag)),
}