File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111 - This behavior already exists for OGG formats.
1212
1313### Fixed
14+ - ** FLAC** : Stop writing invalid ` PADDING ` blocks ([ issue] ( https://github.com/Serial-ATA/lofty-rs/issues/442 ) ) ([ PR] ( https://github.com/Serial-ATA/lofty-rs/pull/446 ) )
15+ - If a ` PADDING ` block existed in the original file, and it wasn't placed at the end of the header, it would
16+ moved without setting the ` Last-metadata-block ` flag. This would cause decoders to believe that the file was missing
1417- ** Fuzzing** (Thanks [ @qarmin ] ( https://github.com/qarmin ) !) ([ PR] ( https://github.com/Serial-ATA/lofty-rs/pull/444 ) ):
1518 - ** MusePack** : Fix panic when tag sizes exceed the stream length ([ issue] ( https://github.com/Serial-ATA/lofty-rs/issues/440 ) )
1619 - ** AAC** : Fix panic when tag sizes exceed the stream length ([ issue] ( https://github.com/Serial-ATA/lofty-rs/issues/439 ) )
Original file line number Diff line number Diff line change 6161
6262 let mut cursor = Cursor :: new ( file_bytes) ;
6363
64- let mut padding = false ;
64+ // TODO: We need to actually use padding (https://github.com/Serial-ATA/lofty-rs/issues/445)
65+ let mut end_padding_exists = false ;
6566 let mut last_block_info = (
6667 stream_info. byte ,
6768 stream_info. start as usize ,
@@ -103,14 +104,20 @@ where
103104 tag. vendor = Cow :: Owned ( vendor_str) ;
104105 } ,
105106 BLOCK_ID_PICTURE => blocks_to_remove. push ( ( start, end) ) ,
106- BLOCK_ID_PADDING => padding = true ,
107+ BLOCK_ID_PADDING => {
108+ if last_block {
109+ end_padding_exists = true
110+ } else {
111+ blocks_to_remove. push ( ( start, end) )
112+ }
113+ } ,
107114 _ => { } ,
108115 }
109116 }
110117
111118 let mut file_bytes = cursor. into_inner ( ) ;
112119
113- if !padding {
120+ if !end_padding_exists {
114121 if let Some ( preferred_padding) = write_options. preferred_padding {
115122 log:: warn!( "File is missing a PADDING block. Adding one" ) ;
116123
You can’t perform that action at this time.
0 commit comments