Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
9.99k stars 1.15k forks source link

this PNG image crashes application when loading #1612

Open Agamnentzar opened 4 years ago

Agamnentzar commented 4 years ago

Issue or Feature

node process is crashing with following message

Exception code=0xc0000005 flags=0x0 at 0x00007FFB878A7DD0. Access violation - attempting to read data at address 0x0000024B46E5D000

image in question:

fail

Steps to Reproduce

var Canvas = require('canvas');
Canvas.loadImage('fail.PNG').then(canvas => console.log(canvas));

Your Environment

Other remarks

on linux it threw "out of memory" error on loading

zbjornson commented 3 years ago

That PNG is corrupt (missing iEND, bad chunk length), but ideally that error would be handled. This looks like a cairo bug. The only open related issue I see is this, which is not quite the same: https://gitlab.freedesktop.org/cairo/cairo/-/issues/254. Fixing this would likely be time-consuming, and rather than fix bugs in current node-canvas I'm hoping to spend more time on a brand new implementation, which should fix this problem as well. Happy to review a PR if anyone wants to work on it though.

Agamnentzar commented 3 years ago

It seems to be libpng bug, updating to latest libpng solves the crashing but still doesn't load the PNG, I don't know if it can be updated independent of cairo though.

pranavburnwal commented 6 months ago

+1