-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Metadata blocks are limited to 16 MiB (+4 bytes) in size by the FLAC specification. At present this limit is not checked when writing out a FLAC file:
Line 142 in 2fce838
| writer.write_all(&content_len.to_be_bytes()[1..])?; |
The impact is that when the metadata block encodes to a larger size the resulting file will be corrupt because the length value in the header doesn't match the length of the data that was written. This is most likely to happen with PICTURE or APPLICATION blocks.
For reference, the official library checks for overly large metadata in several locations but there's a final check when writing out the header for a metadata block:
FLAC__ASSERT(block->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN));
/* double protection */
if(block->length >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN))
return false;with:
FLAC_API const uint32_t FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels