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

crash on malformed png files #185

Open
Fil opened this issue Oct 5, 2020 · 0 comments
Open

crash on malformed png files #185

Fil opened this issue Oct 5, 2020 · 0 comments

Comments

@Fil
Copy link

Fil commented Oct 5, 2020

Steps To Reproduce The Error

echo "hello" > file.png
❯ imageoptim --imagealpha  file.png
i Running ImageAlpha...
! Command failed with exit code 2 (ENOENT): /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/57/f83bftsx79b9ylc2gzbdmdfw0000gp/T/imageoptim-cli/file.png

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    Error: Command failed with exit code 2 (ENOENT): /Applications/ImageAlpha.app/Contents/MacOS/pngquant --ext=.png --force --skip-if-larger --speed=1 --quality=65-80 256 -- /var/folders/57/f83bftsx79b9ylc2gzbdmdfw0000gp/T/imageoptim-cli/file.png
        at makeError (/usr/local/Cellar/imageoptim-cli/3.0.2/libexec/lib/node_modules/imageoptim-cli/dist/imageoptim:6571:11)
        at handlePromise (/usr/local/Cellar/imageoptim-cli/3.0.2/libexec/lib/node_modules/imageoptim-cli/dist/imageoptim:6368:26)
        at process._tickCallback (internal/process/next_tick.js:68:7)

Expected Behaviour

ignore or report malformed png files

Actual Behaviour

crash

Version Numbers or N/A

  • macOS: 10.15.7
  • /Applications/ImageOptim.app: 1.8.8 (brew)
  • /Applications/ImageAlpha.app: 1.5.1 (brew)
  • /Applications/JPEGmini.app: N/A

Help Needed

would the test at

supportedFileTypes.indexOf(extname(filePath)) !== -1;
be complemented by a magic number test on the actual file's contents?

@Fil Fil changed the title crash crash on malformed png files Oct 5, 2020
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

No branches or pull requests

1 participant