Comments (3)
As a temporary fix, I've modified the ID3v2Parser.parseMetadata method to bail out when more than 100K errors have been generated. The metadata is still extracted from the test file I supplied, and the library is passing all mocha tests.
If someone wants me to put up a PR, I'd happy to do so.
from music-metadata.
I had look to your sample. In Node.js in debug mode, it takes 3.9 seconds to parse the file, no issues. A browser may be more sensitive. To have this kind of ID3 header does not make any sense. There is always reverse engineer some data to entertain the parser.
from music-metadata.
Just to clarify, I didn't engineer these files, they appeared as part of a commercial sample pack*. And as things are, a node.js application might very well freeze or crash when the V8 engine isn't able to allocate more resources.
For example, here are some details from such a crash:
<--- Last few GCs --->
[3425:0x7fc070231000] 177340 ms: Scavenge 1995.2 (2064.7) -> 1992.8 (2065.9) MB, 3.6 / 0.0 ms (average mu = 0.659, current mu = 0.404) allocation failure;
[3425:0x7fc070231000] 177348 ms: Scavenge 1996.1 (2065.9) -> 1993.7 (2066.7) MB, 3.4 / 0.0 ms (average mu = 0.659, current mu = 0.404) allocation failure;
[3425:0x7fc070231000] 179108 ms: Scavenge 1997.0 (2066.7) -> 1994.5 (2074.9) MB, 1755.3 / 0.0 ms (average mu = 0.659, current mu = 0.404) allocation failure;
<--- JS stacktrace --->
[3425:0229/105646.552138:ERROR:v8_initializer.cc(714)] V8 javascript OOM (Reached heap limit).
[0229/105646.566016:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffeedcf0000, 0x2000): (os/kern) invalid address (1)
[3417:0229/105646.852725:INFO:render_frame_host_impl.cc(11664)] RenderFrameHostImpl::MaybeGenerateCrashReport url = file:///index.html, status = 3, exit_code = 5
There is always reverse engineer some data to entertain the parser.
Indeed. But isn't that to be expected when parsing random files in the wild? Some are bound to be broken in one or the other way (I guess you have plenty of experience here). And your library even recognizes that something isn't right with the file I provided, because it's logging a zillion errors while parsing it.
So I guess my approach is just a different one: once huge amounts of errors start piling up, I believe it's good to have a way to bail out.
[*] I silenced the audio to avoid copyright issues
from music-metadata.
Related Issues (20)
- any plan or recommend of video metadata browser HOT 1
- ESM, CJS, and everything HOT 3
- ambiguous indirect export: parseFile HOT 1
- After importing the music-metadata, the terminal prompted two errors. I am a novice and I am currently confused. HOT 1
- [email protected] typescript definition is lacking HOT 1
- React Native Compatability HOT 1
- does not provide an export named 'parseFile' HOT 2
- Duration: +Infinity when parsing m4a file HOT 3
- File ratings set in Winamp are not parsed correctly HOT 7
- Get duration of webm audio HOT 3
- Can't parseFile() in Bun.sh
- Parsing WebM consumes a lot of CPU and is slow HOT 1
- expose `core` as separate package export entry in version 8 HOT 4
- Does it support lyrics? HOT 5
- gg audio-codec not recognized (id=HXR 5) HOT 1
- No duration in metadata.format when using parseBuffer HOT 1
- Cannot read properties of undefined (reading 'docType') HOT 2
- Error: "Invalid FLAC preamble" for streams in FLAC format HOT 2
- Documenation: metadata.quality
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from music-metadata.