Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flac.parseStreamInfo reports wrong type when first block is not STREAMINFO #48

Closed
ghost opened this issue Dec 31, 2021 · 3 comments
Closed

Comments

@ghost
Copy link

ghost commented Dec 31, 2021

I happen to have some files where the first metadata block is not a STREAMINFO, but a PICTURE (this is totally bogus, of course).

The problem is reported as follows:

	si, ok := block.Body.(*meta.StreamInfo)
	if !ok {
		return block, fmt.Errorf("flac.parseStreamInfo: incorrect type of first metadata block; expected *meta.StreamInfo, got %T", si)
	}

However, thanks to the type assertion, si will always be a *meta.StreamInfo (albeit nil when !ok).

The error should probably report block.Header.Type instead.

@karlek
Copy link
Contributor

karlek commented Dec 31, 2021

Hi @chucklebot!

Nice catch, I made a PR with a fix. Would you be kind and test your "bogus" file and see if the problem persists?
#49

Happy new years, btw 🎆
Cheers
Henry & Robin

@ghost
Copy link
Author

ghost commented Dec 31, 2021

Looks good to me! I didn't realize you'd made your PR when I got up this morning and so I just did a similar one (#50). Feel free to close it!

Many happy returns, hope you'll have a great 2022!

@mewmew
Copy link
Member

mewmew commented Jan 1, 2022

Fixed in #49.

@mewmew mewmew closed this as completed Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants