Skip to content

Block Size 0 doesn't always mean an invalid flac file, so ignore rather than fail. #45

Description

@tweedj

I've found that scanning my Flac library there are some albums that fail with audio_metadata. Even though these files pass a 'flac -t FILE' they fail to extract with audio_metadata.
I've found that some of these files fail because of a ZERO size in a block, which is caught and triggers an exception.
While this is probably wanted behaviour for the STREAMINFO block, it seems a bit over zealous for blocks like, PADDING and SEEKTABLE.

So rather than call it a bug, I'll ask for a feature change. It requires a 1 (or2) line change in flac.py.

E.g. (Where flay.py in Downloads is the GitHub version)

[2041]$ diff  flac.py ~/Downloads/flac.py 
456,457c456,457
< 		if ( block_size == 0 ) and ( block_type == FLACMetadataBlockType.STREAMINFO ) :
< 			raise FormatError(f"FLAC metadata block {block_type}; size must be greater than 0.")
---
> 		if block_size == 0:
> 			raise FormatError("FLAC metadata block size must be greater than 0.")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions