WeTransfer / format_parser

file metadata parsing, done cheap
https://rubygems.org/gems/format_parser
Other
62 stars 18 forks source link

'read': negative length -1430667650 given (ArgumentError) - caused by `id3tag` #196

Closed lao closed 2 years ago

lao commented 2 years ago

Hey all,

I am working with a very specific mp3 file trying to get all the metadata from it using format parser gem and I got the following error (StringIO throwing on read):

ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/audio_file.rb:53:in `read': negative length -1430667650 given (ArgumentError)

Unfortunately, I cannot share the file within this issue (as I am not the author) and I simply cannot recreate a file with the breaking scenario.

The problem is originated in the id3tag gem and I got it fixed a few days ago with this: https://github.com/krists/id3tag/issues/31

Proposal

Error traceback when using id3tag version v0.14:

Traceback (most recent call last):
        43: from exe/format_parser_inspect:22:in `<main>'
        42: from exe/format_parser_inspect:22:in `map'
        41: from exe/format_parser_inspect:24:in `block in <main>'
        40: from exe/format_parser_inspect:24:in `public_send'
        39: from /****/format_parser/lib/format_parser.rb:109:in `parse_file_at'
        38: from /****/format_parser/lib/format_parser.rb:109:in `open'
        37: from /****/format_parser/lib/format_parser.rb:110:in `block in parse_file_at'
        36: from /****/format_parser/lib/format_parser.rb:178:in `parse'
        35: from /****/format_parser/lib/format_parser.rb:178:in `to_a'
        34: from /****/format_parser/lib/format_parser.rb:178:in `each'
        33: from /****/format_parser/lib/format_parser.rb:178:in `each'
        32: from /****/format_parser/lib/format_parser.rb:178:in `each'
        31: from /****/format_parser/lib/format_parser.rb:178:in `each'
        30: from /****/format_parser/lib/format_parser.rb:174:in `block in parse'
        29: from /****/format_parser/lib/format_parser.rb:206:in `execute_parser_and_capture_expected_exceptions'
        28: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/measurometer-1.3.0/lib/measurometer.rb:48:in `instrument'
        27: from /****/format_parser/lib/format_parser.rb:207:in `block in execute_parser_and_capture_expected_exceptions'
        26: from /****/format_parser/lib/parsers/mp3_parser.rb:103:in `call'
        25: from /****/format_parser/lib/parsers/mp3_parser.rb:318:in `with_id3tag_local_configs'
        24: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag.rb:52:in `local_configuration'
        23: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/configuration.rb:9:in `local_configuration'
        22: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/configuration.rb:32:in `local_configuration'
        21: from /****/format_parser/lib/parsers/mp3_parser.rb:322:in `block in with_id3tag_local_configs'
        20: from /****/format_parser/lib/parsers/mp3_parser.rb:103:in `block in call'
        19: from /****/format_parser/lib/parsers/mp3_parser.rb:302:in `blend_id3_tags_into_hash'
        18: from /****/format_parser/lib/parsers/mp3_parser.rb:302:in `each_with_object'
        17: from /****/format_parser/lib/parsers/mp3_parser.rb:302:in `each'
        16: from /****/format_parser/lib/parsers/mp3_parser.rb:303:in `block in blend_id3_tags_into_hash'
        15: from /****/format_parser/lib/parsers/mp3_parser.rb:50:in `to_h'
        14: from /****/format_parser/lib/parsers/mp3_parser.rb:50:in `each_with_object'
        13: from /****/format_parser/lib/parsers/mp3_parser.rb:50:in `each'
        12: from /****/format_parser/lib/parsers/mp3_parser.rb:52:in `block in to_h'
        11: from /****/format_parser/lib/parsers/mp3_parser.rb:52:in `public_send'
        10: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:19:in `block (2 levels) in <class:Tag>'
         9: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:24:in `content_of_first_frame'
         8: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:40:in `first_frame_by_id'
         7: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:40:in `find'
         6: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:40:in `each'
         5: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:40:in `block in first_frame_by_id'
         4: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:64:in `frame_ids'
         3: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:68:in `frames'
         2: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/tag.rb:73:in `v2_frames'
         1: from /*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/audio_file.rb:59:in `v2_tag_body'
/*/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/id3tag-0.14.1/lib/id3tag/audio_file.rb:59:in `read': negative length -1430667650 given (ArgumentError)

Results when using id3tag version v0.14.2

mp3-id3tag-update-formatparser