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

Node exits on Invalid File Signature with certain images #359

Open
dvoraqs opened this issue Mar 8, 2019 · 0 comments · May be fixed by #362
Open

Node exits on Invalid File Signature with certain images #359

dvoraqs opened this issue Mar 8, 2019 · 0 comments · May be fixed by #362

Comments

@dvoraqs
Copy link

dvoraqs commented Mar 8, 2019

We are trying to use Quagga in Node with the Node example code using Quagga.decodeSingle and it exits with this error with some specific images:

Error: Invalid file signature
    at module.exports.Parser._parseSignature (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/parser.js:50:18)
    at module.exports.ChunkStream._processRead (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/chunkstream.js:174:13)
    at module.exports.ChunkStream._process (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/chunkstream.js:193:14)
    at module.exports.ChunkStream.write (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/chunkstream.js:61:8)
    at module.exports.ChunkStream.end (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/chunkstream.js:74:10)
    at exports.PNG.PNG.end (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/png.js:98:16)
    at exports.PNG.PNG.parse (/Users/dvoraqs/ccom/service/node_modules/pngjs/lib/png.js:88:8)
    at handlePNG (/Users/dvoraqs/ccom/service/node_modules/get-pixels/node-pixels.js:17:7)
    at doParse (/Users/dvoraqs/ccom/service/node_modules/get-pixels/node-pixels.js:109:7)
    at /Users/dvoraqs/ccom/service/node_modules/get-pixels/node-pixels.js:190:7
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:528:3)
events.js:136
      throw er; // Unhandled 'error' event
      ^

I tried to look around at the code in Quagga and identified this as a possible culprit of the app crashing inside of input_stream.js:

...
function loadImages() {
        loaded = false;
        GetPixels(baseUrl, _config.mime, function(err, pixels) {
            if (err) {
                console.log(err);
                exit(1);
            }
...

Our application is an Express web app that shouldn't exit if it can't process an image. This is problematic in our case because our app cannot fail gracefully and return a response to the user if it just exits. Can this error just be thrown back to your consumer to handle in whatever way they like?

@dvoraqs dvoraqs changed the title Node exits on Invalid File Signature on certain images Node exits on Invalid File Signature with certain images Mar 8, 2019
@dvoraqs dvoraqs linked a pull request Mar 19, 2019 that will close this issue
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 a pull request may close this issue.

1 participant