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

Uncaught exception with malformed PNG #1261

Open
Lambdac0re opened this issue Sep 27, 2023 · 2 comments
Open

Uncaught exception with malformed PNG #1261

Lambdac0re opened this issue Sep 27, 2023 · 2 comments
Labels
bug there is a bug in the way jimp behaves

Comments

@Lambdac0re
Copy link

Expected Behavior

Either not crashing or properly handling of the error (useful error message for example).

Current Behavior

Error: End-Of-Stream
    at BufferTokenizer.peekBuffer (C:\js\yeet-ocr\node_modules\strtok3\lib\BufferTokenizer.js:44:19)
    at BufferTokenizer.readBuffer (C:\js\yeet-ocr\node_modules\strtok3\lib\BufferTokenizer.js:30:38)
    at BufferTokenizer.readToken (C:\js\yeet-ocr\node_modules\strtok3\lib\AbstractTokenizer.js:25:32)
    at readChunkHeader (C:\js\yeet-ocr\node_modules\file-type\core.js:978:29)
    at _fromTokenizer (C:\js\yeet-ocr\node_modules\file-type\core.js:984:24)
    at async getMIMEFromBuffer (C:\js\yeet-ocr\node_modules\@jimp\core\dist\utils\image-bitmap.js:19:30)
    at async Jimp.parseBitmap (C:\js\yeet-ocr\node_modules\@jimp\core\dist\utils\image-bitmap.js:149:16)

Failure Information (for bugs)

Steps to Reproduce

Use attached file:

Jimp
.read(buffer)
.then(jimpObj => jimpObj.getBufferAsync(Jimp.MIME_PNG))

Context

  • Jimp Version: 0.22.10
  • Operating System: Windows 10
  • Node version: 16

Failure Logs

broken-png

@Lambdac0re
Copy link
Author

The same file gives you this useful error message with sharp:
"Input buffer has corrupt header: pngload_buffer: end of stream"

@Lambdac0re
Copy link
Author

Here is another example:

https://i.imgur.com/dYKD1.png

@hipstersmoothie hipstersmoothie added the bug there is a bug in the way jimp behaves label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug there is a bug in the way jimp behaves
Projects
None yet
Development

No branches or pull requests

2 participants