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

Crashes and hangs in ctx.arc() #2055

Closed
zbjornson opened this issue Jun 19, 2022 · 0 comments · Fixed by #2083
Closed

Crashes and hangs in ctx.arc() #2055

zbjornson opened this issue Jun 19, 2022 · 0 comments · Fixed by #2083
Assignees
Labels

Comments

@zbjornson
Copy link
Collaborator

Steps to Reproduce

Many of these from the web-platform-tests crash or hang (more than the ones I marked):

it("2d.path.arc.nonfinite", function () {
	const canvas = createCanvas(100, 150);
	const ctx = canvas.getContext("2d");
	ctx.fillStyle = '#f00';
	ctx.fillRect(0, 0, 100, 50);
	ctx.moveTo(0, 0);
	ctx.lineTo(100, 0);
	ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true);
	ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true);
	ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true);
	ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true);
	ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true);
	ctx.arc(0, NaN, 50, 0, 2*Math.PI, true);
	ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); // hang
	ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true);
	ctx.arc(0, 0, NaN, 0, 2*Math.PI, true);
	ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); // assertion failure
	ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true);
	ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); // assertion failure
	ctx.arc(0, 0, 50, 0, Infinity, true); // assertion failure
	ctx.arc(0, 0, 50, 0, -Infinity, true);
	ctx.arc(0, 0, 50, 0, NaN, true);
	ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true);
	ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true);
	ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true);
	ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true);
	ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true);
	ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true);
	ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true);
	ctx.arc(Infinity, Infinity, 50, 0, Infinity, true);
	ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true);
	ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true);
	ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true);
	ctx.arc(Infinity, 0, Infinity, 0, Infinity, true);
	ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true);
	ctx.arc(Infinity, 0, 50, Infinity, Infinity, true);
	ctx.arc(Infinity, 0, 50, 0, Infinity, true);
	ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true);
	ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true);
	ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true);
	ctx.arc(0, Infinity, Infinity, 0, Infinity, true);
	ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true);
	ctx.arc(0, Infinity, 50, Infinity, Infinity, true);
	ctx.arc(0, Infinity, 50, 0, Infinity, true);
	ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true);
	ctx.arc(0, 0, Infinity, Infinity, Infinity, true);
	ctx.arc(0, 0, Infinity, 0, Infinity, true);
	ctx.arc(0, 0, 50, Infinity, Infinity, true);
});

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): HEAD (2.9.1)
  • Environment (e.g. node 4.2.0 on Mac OS X 10.8): all
@zbjornson zbjornson added the Bug label Jun 19, 2022
zbjornson added a commit that referenced this issue Jul 27, 2022
The WPT tests for this now pass. See issue for test content; I think it makes more sense to land the WPT tests than to copy individual ones into the node-canvas tests.

Fixes #2055
@zbjornson zbjornson self-assigned this Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant