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
11
11
- This behavior already exists for OGG formats.
12
12
13
13
### 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
14
17
- ** Fuzzing** (Thanks [ @qarmin ] ( https://github.com/qarmin ) !) ([ PR] ( https://github.com/Serial-ATA/lofty-rs/pull/444 ) ):
15
18
- ** MusePack** : Fix panic when tag sizes exceed the stream length ([ issue] ( https://github.com/Serial-ATA/lofty-rs/issues/440 ) )
16
19
- ** 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 61
61
62
62
let mut cursor = Cursor :: new ( file_bytes) ;
63
63
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 ;
65
66
let mut last_block_info = (
66
67
stream_info. byte ,
67
68
stream_info. start as usize ,
@@ -103,14 +104,20 @@ where
103
104
tag. vendor = Cow :: Owned ( vendor_str) ;
104
105
} ,
105
106
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
+ } ,
107
114
_ => { } ,
108
115
}
109
116
}
110
117
111
118
let mut file_bytes = cursor. into_inner ( ) ;
112
119
113
- if !padding {
120
+ if !end_padding_exists {
114
121
if let Some ( preferred_padding) = write_options. preferred_padding {
115
122
log:: warn!( "File is missing a PADDING block. Adding one" ) ;
116
123
You can’t perform that action at this time.
0 commit comments