leosongwei / mutagen

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

Lots of FLAC-files can't be loaded #106

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm having trouble loading some FLAC files with mutagen: 
http://paste.pocoo.org/show/547192/ shows the trace.

The file in question is part of 
http://blocsonic.com/releases/show/netbloc-vol-36-get-dusted-illness-from-the-du
sted-wax-stacks (all other files are affected), 
http://blocsonic.com/releases/show/netbloc-vol-37-five is affected too, 
http://blocsonic.com/releases/show/netbloc-vol-35-occupy-music is not.

Original issue reported on code.google.com by themineo on 7 Feb 2012 at 9:40

GoogleCodeExporter commented 9 years ago
first 1.5MB of the file in question

also fails with trunk

Original comment by reiter.christoph@gmail.com on 7 Feb 2012 at 10:37

Attachments:

GoogleCodeExporter commented 9 years ago
There are lots of places where fileobj.read(x) isn't checked or will silently 
fail (to_int_be) and lead to even more corrupt files after saving (StreamInfo 
for example)

What about wrapping the fileobj and raise if the read size doesn't match?

Original comment by reiter.christoph@gmail.com on 21 Feb 2012 at 12:45

GoogleCodeExporter commented 9 years ago
That seems like a reasonable approach.

Original comment by joe.wreschnig@gmail.com on 21 Feb 2012 at 1:56

GoogleCodeExporter commented 9 years ago
Last block has zero size but includes the valid picture block if the size is 
ignored. 

Offending software (according to the blocsonic guy): Amadeus Pro 
http://www.hairersoft.com/pro.html

original: gstreamer fails, vlc works but no image, easytag shows tags/image
save with writing back invalid block: gstreamer fails, vlc still works, easytag 
shows only tags
save with ignoring size: gstreamer ok, vlc ok, easytag shows tags/image

So I would suggest to ignore the size for all blocks that have their own size 
info. Writing back the invalid blocks leaves 1MB of image garbage in there and 
as can be seen above at least gstreamer doesn't find the audio header, others 
that work with the original file might fail after that as well.

Original comment by reiter.christoph@gmail.com on 22 Feb 2012 at 12:59

GoogleCodeExporter commented 9 years ago
 - wrap the file object and check returned read size
 - add _distrust_size attribute to MetadataBlock (True for Picture and VCFLACDict) and leave reading to the block if True.

because I didn't write it above: metaflac/libflac also ignores the block size 
for the Picture block.

tests:
 - 106-short-picture-block-size.flac
   zero size picture block with valid picture
 - 106-invalid-streaminfo.flac
   too short stream info block (missing the checksum), to test read check

Original comment by reiter.christoph@gmail.com on 9 Apr 2012 at 4:41

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r124.

Original comment by reiter.christoph@gmail.com on 25 Jul 2012 at 11:42

GoogleCodeExporter commented 9 years ago
Commited: The above patch unchanged but split up in object-wrapper and 
picture-block part.

Original comment by reiter.christoph@gmail.com on 25 Jul 2012 at 11:44