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 crashes when passing canvas with width or height 0 to createPNGStream() #2443

Open
six5536 opened this issue Oct 21, 2024 · 0 comments
Open

Comments

@six5536
Copy link

six5536 commented Oct 21, 2024

Node: v20, v22.8.0
node-canvas: v2.11.2

Node crashes when passing canvas with width or height 0 to createPNGStream(). Ok, this is not a valid thing to do, but it should not crash node.

const canvas = new Canvas(12, 0);
const out = fs.createWriteStream('image.png');
const stream = canvas.createPNGStream();
stream.pipe(out);
out
        .on('close', () => {
          console.log('close, happens');
        })
        .on('finish', () => {
          console.log('finish, never happens, node crashes');
        })
        .on('error', () => {
          console.log('error, never happens, node crashes');
        })
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