Skip to content

Improve handling of UTF-16 strings in Node.js and prevent out of bound error when attempting to parse incomplete frames at the end#63

Open
pqnet wants to merge 2 commits into43081j:masterfrom
pqnet:master
Open

Conversation

@pqnet
Copy link

@pqnet pqnet commented Mar 12, 2025

  • Some malformed ID3V2 tags like the ones created by LAME 3.96.1 have padding bytes after all the frames. This code patches the loop condition to end the loop early when there is not enough bytes left in the tag for a full frame header (6 for v2.2, 10 for v2.3) to prevent a crash when reading those tags
  • the previous UTF-16 reading code, in the Buffer/nodejs case, would create a character for each byte in the input rather than doing the proper decoding. This is a temporary solution until a more robust solution using TextDecoder, which supports both nodejs and browser, is implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant