question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Offset is not uint

See original GitHub issue

Issue description

I am working on a music track uploader. The user is supposed to upload a music file, and the uploader is supposed to display the file metadata, once the upload is successful.

I have two mp3 files that both have the same kind of metadata, tracks A and B.

Track A’s metadata are read and displayed fine.

Track B’s displays no metadata.

I investigated on this, and the cause of the issue is that at some point, after the track has been translated into an array buffer, a checkOffset is called with an offset argument that is undefined, and as a result it throws (file location is node_modules/node-libs-browser/node_modules/buffer/index.js line 1097).

The best I could do, was check the initial array buffer for any undefined data inside of it, but the .some() I run on it returned false.

The stack trace is this:

checkOffset (index.js:1165)
readUInt32LE (index.js:1218)
postMap (ID3v24TagMapper.js:194)
mapGenericTag (GenericTagMapper.js:40)
mapTag (CombinedTagMapper.js:54)
toCommon (MetadataCollector.js:256)
addTag (MetadataCollector.js:115)
addTag (ID3v2Parser.js:409)
_callee4$ (ID3v2Parser.js:357)
tryCatch (runtime.js:63)
invoke (runtime.js:282)
prototype.(anonymous function) (runtime.js:116)
fulfilled (ID3v2Parser.js:13)
Promise.then (async)
step (ID3v2Parser.js:30)
(anonymous) (ID3v2Parser.js:33)
push../node_modules/music-metadata/lib/id3v2/ID3v2Parser.js.__awaiter (ID3v2Parser.js:10)
parseId3Data (ID3v2Parser.js:170)
_callee$ (ID3v2Parser.js:95)
tryCatch (runtime.js:63)
invoke (runtime.js:282)
prototype.(anonymous function) (runtime.js:116)
fulfilled (ID3v2Parser.js:13)
Promise.then (async)
step (ID3v2Parser.js:30)
(anonymous) (ID3v2Parser.js:33)
push../node_modules/music-metadata/lib/id3v2/ID3v2Parser.js.__awaiter (ID3v2Parser.js:10)
parse (ID3v2Parser.js:59)
_callee2$ (AbstractID3Parser.js:162)
tryCatch (runtime.js:63)
invoke (runtime.js:282)
prototype.(anonymous function) (runtime.js:116)
fulfilled (AbstractID3Parser.js:19)
Promise.then (async)
step (AbstractID3Parser.js:36)
(anonymous) (AbstractID3Parser.js:39)
push../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js.__awaiter (AbstractID3Parser.js:16)
tryReadId3v2Headers (AbstractID3Parser.js:141)
_callee$ (AbstractID3Parser.js:105)
tryCatch (runtime.js:63)
invoke (runtime.js:282)
prototype.(anonymous function) (runtime.js:116)
(anonymous) (AbstractID3Parser.js:39)
push../node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js.__awaiter (AbstractID3Parser.js:16)
parseID3v2 (AbstractID3Parser.js:96)
parse (AbstractID3Parser.js:83)
_callee3$ (ParserFactory.js:287)
tryCatch (runtime.js:63)
invoke (runtime.js:282)
prototype.(anonymous function) (runtime.js:116)
fulfilled (ParserFactory.js:13)
Promise.then (async)
step (ParserFactory.js:30)
(anonymous) (ParserFactory.js:33)
push../node_modules/music-metadata/lib/ParserFactory.js.__awaiter (ParserFactory.js:10)
_parse (ParserFactory.js:272)
_callee$ (ParserFactory.js:138)
tryCatch (runtime.js:63)
invoke (runtime.js:282)
prototype.(anonymous function) (runtime.js:116)
(anonymous) (ParserFactory.js:33)
push../node_modules/music-metadata/lib/ParserFactory.js.__awaiter (ParserFactory.js:10)
parse (ParserFactory.js:92)
parseFromTokenizer (core.js:56)
parseBuffer (core.js:37)
(anonymous) (index.js:61)
Promise.then (async)
parseBlob (index.js:60)

Can you direct me to the right direction for solving this?

I can provide you with the track files as well if you ask.

Thank you, and thank you for this library.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mkarajohncommented, Apr 4, 2019

Ok, there is something very strange happening, and I would like your assistance to confirm my findings.

Here is the sandbox I created. It is very simple; it’s a create-react-app project, the only dependency is music-metadata-browser, and all it does is show the cover art of the track you uploaded (use the 2 files from here)

As you can hopefully see, this example, running on codesandbox.io, works fine.

Now, here is the more involved part, as you will have to create a new create-react-app project, locally, on your machine. (instructions here in case you don’t remember, so that you don’t need to search).

Then copy paste, from codesandbox to your local project, the contents of the following files:

  • src/index.js
  • package.json

And finally yarn/npm install and yarn start. You do not need to eject.

I have executed the above steps on 3 separate machines (2 running macOS and 1 running Ubuntu) and the buffer package is always getting pulled from the wrong place. Check the included screenshot and see the path of checkOffset(). It should be pulled from node_modules/buffer (which has v5.2) instead it gets pulled from node_modules/node-libs-browser/node_modules/buffer (which has v4.9)

Can you confirm that it does not work locally for you either?

Btw, you are right this doesn’t look like a yarn/npm issue, I should file this to webpack, if it comes to this.

Thank you for your time. Screen Shot 2019-04-04 at 13 42 47

0reactions
Borewitcommented, Aug 10, 2019

It looks like we addressed this issue in more constructive way in #28. Implemented a workaround for compatibility with node v4 in version v1.2.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

RangeError: offset is not uint · Issue #311 · tulios/kafkajs - GitHub
I am getting the error RangeError: offset is not uint from the example code. Any ideas? <script> export default { name: "KafkaClient", props:...
Read more >
I don't Understand - *(uint*)((byte*)p + Offset) - Stack Overflow
If we ignore Offset , you have *(uint*)((byte*)p) = value;. which is just assigning value to what p points to, interpreted as a...
Read more >
Buffer | Node.js v19.3.0 Documentation
sourceEnd <integer> The offset within buf at which to stop copying (not inclusive). Default: buf.length . Returns: <integer> The number of bytes copied....
Read more >
Function: Printing Stack (in stack.c) Create a | Chegg.com
c) Create a function that takes a string message and an integer number offset. It should print the followings to the standard error...
Read more >
%OFFSET built-in function for i5/OS - IBM
The offset built-in function (%OFFSET or %OFS) can be used to store or change the offset portion of a CL pointer variable and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found