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

Hangs when improper image content is encountered instead of dying #489

Open
Peter-Sparksuite opened this issue Apr 18, 2024 · 0 comments
Open
Labels

Comments

@Peter-Sparksuite
Copy link

Peter-Sparksuite commented Apr 18, 2024

Describe the bug

Tooling that produces the images shouldn't be producing invalid png images, but, it seems, pngjs is hypersensitive in some regard. When this happens, details about the error are displayed (stack trace & error message), but, the reg-cli tool hangs instead of completing.

/node_modules/pngjs/lib/parser.js:48
      this.error(new Error("Invalid file signature"));
                 ^

Error: Invalid file signature
    at Parser._parseSignature (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/parser.js:48:18)
    at ChunkStream._processRead (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/chunkstream.js:160:13)
    at ChunkStream._process (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/chunkstream.js:175:14)
    at ChunkStream.write (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/chunkstream.js:57:8)
    at PNG.write (/Users/loginname/gitlab/tool/node_modules/pngjs/lib/png.js:95:16)
    at ReadStream.ondata (node:internal/streams/readable:809:22)
    at ReadStream.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)

Node.js v18.20.1

Reproduced step

Steps to reproduce the behavior:

  1. Images for comparison are created, with one or more having details that pnpjs appears to consider invalid
  2. Run the reg-cli tool, specifying the new image folder path, the old image folder path, a path for the temp folder, --json {path to report.json} --report {path to report.html} --ignoreChange --matchingThreshold=0.05
  3. Observe the error report shown above
  4. Observe that the command never terminates

Expected behavior

The command should finish up with a non-zero return code and a message indicating the cause of the problem.

Actual behavior

The tool never completes. Output does show the error being encountered, but app hangs instead of finishes.

Screenshots

......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant