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

Fails to load wav with ID3 with an invalid zero byte header #67

Closed
ianhomer opened this issue Mar 27, 2019 · 1 comment
Closed

Fails to load wav with ID3 with an invalid zero byte header #67

ianhomer opened this issue Mar 27, 2019 · 1 comment

Comments

@ianhomer
Copy link
Contributor

ianhomer commented Mar 27, 2019

I have a wav file that failed to load with TinyTag. I think it was created it with originally created with audacity a while ago, however I've created a small unit test to simulate the issue.

When I try to load this file I get the error

Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/Users/ian/projects/opensource/tinytag/tinytag/tests/test.py", line 114, in get_info tag = TinyTag.get(filename) File "/Users/ian/projects/opensource/tinytag/tinytag/tinytag.py", line 132, in get tag.load(tags=tags, duration=duration, image=image) File "/Users/ian/projects/opensource/tinytag/tinytag/tinytag.py", line 146, in load self._parse_tag(self._filehandler) File "/Users/ian/projects/opensource/tinytag/tinytag/tinytag.py", line 864, in _parse_tag self._determine_duration(fh) # parse whole file to determine tags:( File "/Users/ian/projects/opensource/tinytag/tinytag/tinytag.py", line 855, in _determine_duration id3._parse_id3v2(fh) File "/Users/ian/projects/opensource/tinytag/tinytag/tinytag.py", line 597, in _parse_id3v2 frame_size = self._parse_frame(fh, id3version=major) File "/Users/ian/projects/opensource/tinytag/tinytag/tinytag.py", line 633, in _parse_frame frame = struct.unpack(binformat, frame_header_data) struct.error: unpack requires a buffer of 10 bytes

When I dump the frame_header_data values in the _parse_frame method I see ...

b'TRCK\x00\x00\x00\x03\x00\x00' b'TIT2\x00\x00\x00\x08\x00\x00' b'\x00'

Essentially I see this zero byte in the final header. Possibly an invalid ID3 tag header, however TinyTag does have the opportunity to handle such headers without failure.

I'll create PR shortly demonstrating this with a unit test with a candidate fix.

@ianhomer ianhomer changed the title Wav with ID3 with a zero byte header Fails to load wav with ID3 with an invalid zero byte header Mar 27, 2019
ianhomer added a commit to ianhomer/tinytag that referenced this issue Mar 27, 2019
…byte

Ensure ID3 header value matches expected size before loading tinytag#67
devsnd added a commit that referenced this issue Apr 13, 2019
…-byte

#67 : Ensure ID3 header value matches expected size before loading
@devsnd
Copy link
Member

devsnd commented Apr 13, 2019

This is fixed in your PR #68, right? I'm closing this ticket, please reopen if I misunderstood.

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

No branches or pull requests

2 participants