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

Reader instances can be created for WAVE_FORMAT_EXTENSIBLE files that have an incomplete/missing format chunk extension #34

Closed
jstrait opened this issue Sep 22, 2020 · 1 comment
Assignees
Labels

Comments

@jstrait
Copy link
Owner

jstrait commented Sep 22, 2020

When a fmt chunk has the format code 65534 (i.e. WAVE_FORMAT_EXTENSIBLE) it is required to have a chunk extension of 22 bytes containing 3 fields. These fields, especially the final 16 byte "audio format GUID" field, are required in order to correctly read the file's sample data, and don't have sensible default values.

In v1.1.1 of the gem a Reader instance can be created, without any error being raised, for some WAVE_FORMAT_EXTENSIBLE files in which the fmt chunk has a missing/truncated extension. The readable_format? field on the Reader instance will be correctly set to false, so no sample data will be able to be read out of it. However, the object attached to format and native_format will contain invalid values (i.e. either nil or "") for the missing extension fields.

It seems like a bug that Reader instances can be created from files like this. These are malformed files, and some of the information shown in the objects returned by format and native_format will not necessarily be meaningful/accurate. It seems like better behavior would be to instead raise an InvalidFormatError when trying to read this type of file, and not allow a Reader instance to be created.

@jstrait
Copy link
Owner Author

jstrait commented Dec 30, 2022

This is now fixed in v1.1.2, so closing this issue.

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

No branches or pull requests

1 participant