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

EOFError when reading too-short MP3s #110

Closed
lazka opened this issue Jul 4, 2014 · 5 comments
Closed

EOFError when reading too-short MP3s #110

lazka opened this issue Jul 4, 2014 · 5 comments
Labels

Comments

@lazka
Copy link
Member

@lazka lazka commented Jul 4, 2014

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From adrian.sampson on May 17, 2012 20:03:07

When an MP3 file is truncated but contains a full header, id3.py can raise an unhanded EOFError in __fullread(). With the attached test.mp3, the following one-liner results in the following traceback. (I ran this against svn r108 of mutagen.)

$ python -c 'import mutagen; print mutagen.File("test.mp3")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "mutagen/__init__.py", line 216, in File
    if score > 0: return Kind(filename)
  File "mutagen/__init__.py", line 75, in __init__
    self.load(filename, *args, **kwargs)
  File "mutagen/id3.py", line 2070, in load
    try: self.tags = ID3(filename, **kwargs)
  File "mutagen/id3.py", line 76, in __init__
    super(ID3, self).__init__(*args, **kwargs)
  File "mutagen/_util.py", line 107, in __init__
    super(DictProxy, self).__init__(*args, **kwargs)
  File "mutagen/__init__.py", line 39, in __init__
    self.load(*args, **kwargs)
  File "mutagen/id3.py", line 137, in load
    data = self.__fullread(self.size - 10)
  File "mutagen/id3.py", line 84, in __fullread
    (long(size), long(self.__filesize), self.filename))
EOFError: Requested 0x14632 of 0x594 (../test.mp3)

Attachment: test.mp3

Original issue: http://code.google.com/p/mutagen/issues/detail?id=110


@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From reiter.christoph@gmail.com on July 19, 2012 04:20:02

I think this is on purpose. Use id3.error to handle it.
@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From adrian.sampson on July 19, 2012 09:00:58

No, the EOFError raised here is the standard Python built-in EOFError, not a subtype of mutagen.id3.error. The following script, which catches id3.error, lets the same exception through.

import mutagen
try:
    print mutagen.File('test.mp3')
except mutagen.id3.error:
    print 'id3 error'
@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From reiter.christoph@gmail.com on July 19, 2012 05:03:19

Status: WontFix

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Jul 4, 2014

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


From reiter.christoph@gmail.com on July 19, 2012 11:12:44

Right, sorry.

Status: Accepted

@lazka

This comment has been minimized.

Copy link
Member Author

@lazka lazka commented Feb 2, 2015

Original comment by Christoph Reiter (Bitbucket: lazka, GitHub: lazka):


id3: Don't leak EOFError with too small files. (Fixes issue #110)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.