-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Loading a JPEG with precision set to 12 crashes all processes #1160
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
Comments
Can you post your 12-bit jpeg here please? I'm not finding one to test with by googling. I think (a) we can prevent the process abort and instead trigger a nice error, but (b) actually handling 12-bit jpegs will require you (or prebuilds, if you're using them) to update your jpeg lib. |
Tested on Windows 10 with versions 1.6.9 and 2.0.0 and git-master and I'm unable to reproduce this issue. The error callback is properly called and the error is caught. The code I used: var img = new Image();
img.onload = () => {
console.log('ok');
};
img.onerror = err => {
console.log('Error occured');
throw err;
};
img.src = fs.readFileSync('test.jpg'); The 12-bit image I used: test.zip |
@zbjornson here are a few sample images that cause the issue for us: @Hakerh400 I ran the sample image provided through the example code also provided and am able to reproduce the same I believe @zbjornson hit the nail on the head in that we would need to update our jpeg lib to actually handle 12 bit precision, however I'd think this error shouldn't crash the process running it, correct? |
@logicbomb421 Thanks. Can you also post the result of |
@zbjornson that call returns |
Interesting, that's the latest version. 9a added 12-bit color support. Will try to look at this in the next few weeks. |
It seems that 12-bit support is a build-time flag. |
Good find. But, oof: |
When attempting to set the
src
property of aCanvas.Image
object with aBuffer
, all processes (node-canvas
, our user app, etc) crash if the buffer contains a JPEG image with precision set to 12 bits.Interestingly, wrapping the
src
set in atry/catch
does not catch the error. The only way to catch it is visually by running the process and watching the command line, which will produce the following:I have also tried to set the
img.onerror
handler to get more context, however it seems this is never called before the process(es) crash.Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: