Serial-ATA / lofty-rs

Audio metadata library
Apache License 2.0
182 stars 34 forks source link

ID3v2: Remove invalid padding on write #262

Open Serial-ATA opened 9 months ago

Serial-ATA commented 9 months ago

It's a common issue that padding will often stick around between tag edits, as it is typically not properly accounted for in the tag header size.

We currently just get the tag size from the header and replace that many bytes with the new tag when writing, similar to other libraries. The problem is, when a tag has invalid padding that isn't included in the size, it will remain in the file indefinitely.

It may be worth removing the padding if we can reliably detect it without destroying any important data.