leosongwei / mutagen

Automatically exported from code.google.com/p/mutagen
GNU General Public License v2.0
0 stars 0 forks source link

MP3: Fails to load files that are too small #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is with mutagen 1.15-2 (as found in Ubuntu Lucid repository)

>>> from mutagen.mp3 import MP3
>>> MP3("Track 10.mp3")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/mutagen/__init__.py", line 73, in __init__
    self.load(filename, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/id3.py", line 1957, in load
    self.info = self._Info(fileobj, offset)
  File "/usr/lib/python2.6/dist-packages/mutagen/mp3.py", line 95, in __init__
    try: self.__try(fileobj, int(i), size - offset)
  File "/usr/lib/python2.6/dist-packages/mutagen/mp3.py", line 166, in __try
    frame_data = struct.unpack(">H", data[possible:possible + 2])[0]
struct.error: unpack requires a string argument of length 2
>>> 

I have noticed that for this file at the time the exception is thrown, 
len(data) == possible. 

I have my own workaround however I do not want to publish it because I haven't 
taken the time to understand the code that surrounds it.  

I have attached the file for your convenience.

Original issue reported on code.google.com by Ms.Shap...@gmail.com on 21 Sep 2010 at 2:40

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by joe.wreschnig@gmail.com on 27 Oct 2010 at 12:50

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/mutagen/source/detail?r=95

Original comment by joe.wreschnig@gmail.com on 27 Oct 2010 at 12:51