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

Unexpected "out of range" error in APEv2Parser.parseTags() #2100

Closed
2 tasks done
msikma opened this issue Jun 25, 2024 · 2 comments
Closed
2 tasks done

Unexpected "out of range" error in APEv2Parser.parseTags() #2100

msikma opened this issue Jun 25, 2024 · 2 comments
Assignees
Labels
bug Bug, will addressed with high priority

Comments

@msikma
Copy link

msikma commented Jun 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

music-metadata version

8.3.0

JavaScript module eco system

ECMAScript modules (ESM), music-medata ≥ version 8

Current Behavior

When parsing the given file "13-newip-Crimsonland-Across The Crimson Lands-DoD.mp3" from the DoD project (April 2016, track 13) (direct file link), the following error occurs:

ERR_OUT_OF_RANGE RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be >= 0. Received -1431655663
    at Object.read (node:fs:673:3)
    at file:///Users/msikma/Files/Work/Code/musidx/node_modules/strtok3/lib/FsPromise.js:39:12
    at new Promise (<anonymous>)
    at Module.read (file:///Users/msikma/Files/Work/Code/musidx/node_modules/strtok3/lib/FsPromise.js:38:12)
    at FileTokenizer.peekBuffer (file:///Users/msikma/Files/Work/Code/musidx/node_modules/strtok3/lib/FileTokenizer.js:33:30)
    at APEv2Parser.parseTags (file:///Users/msikma/Files/Work/Code/musidx/node_modules/music-metadata/lib/apev2/APEv2Parser.js:101:34)
    at async ID3v1Parser.parse (file:///Users/msikma/Files/Work/Code/musidx/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js:96:13)
    at async MpegParser.parseID3v2 (file:///Users/msikma/Files/Work/Code/musidx/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js:44:13)
    at async MpegParser.parse (file:///Users/msikma/Files/Work/Code/musidx/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js:21:13)
    at async parse (file:///Users/msikma/Files/Work/Code/musidx/node_modules/music-metadata/lib/ParserFactory.js:35:5)

Expected Behavior

The file is parsed, and metadata such as the title and artist are returned.

As far as I can tell the file should work, and it opens fine in mp3tag.

This file is a free release from a community music project, so it can be freely downloaded for testing.

Attached audio sample?

  • I have provided sufficient information to reproduce the issue
@msikma msikma added the bug Bug, will addressed with high priority label Jun 25, 2024
@Borewit Borewit pinned this issue Jul 20, 2024
@Borewit Borewit self-assigned this Jul 20, 2024
@Borewit
Copy link
Owner

Borewit commented Jul 21, 2024

Although I did find some problems in the APE-Header-Parser, I think the header in this file is corrupt.

image

The APETAGEX indicates the start of the 32 byte long APE header.
This was detected as the footer, and results in a wrong header calculation offset.

The header is appearing before the meta tags, the header after the meta tags, and then there are cases where only 1 of those headers are used.

Anyway, solved that, but after the 32 byte footer the 10 byte APE Tag Item is expected to start. This is where you see TAGA, yet that TAGA should be the tag size, which is clearly is not. This is the where I believe the TAG header is corrupt.

Does it open fine in mp3tag? Well, it may not complain about the corrupt APE header, but I don't think mp3tags is decoding that APE header.

@Borewit
Copy link
Owner

Borewit commented Jul 21, 2024

Feel free to re-open, if there are any updates.

@Borewit Borewit unpinned this issue Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, will addressed with high priority
Projects
None yet
Development

No branches or pull requests

2 participants