processing / processing/p5.js

[p5.js 2.0 Bug Report]: ellipse() with negative detail crashes in WEBGL

Open
#8,526 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Core Area:WebGL p5.js 2.0+
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
p5.js version

2.2.0

Web browser and version

Google chrome Version 144.0.7559.133

Operating system

Windows 11

Steps to reproduce this
Steps:
  1. Create WEBGL canvas
  2. Call ellipse()
  3. Pass a negative detail value
Snippet:

function setup() {
  createCanvas(200, 200, WEBGL);
  noLoop();
}

function draw() {
  ellipse(0, 0, 100, 100, -10);
}



Observed Behaviour:

Sketch crashes when ellipse() is called with negative detail.
Renderer stops and runtime exception occurs.

Expected Behaviour:

Negative detail values should not crash the renderer.

Possible alternatives:
• Clamp to minimum valid value
• Ignore invalid input
• Throw friendly error

Additional Note
Tested with:

  • ellipse(..., -1)
  • ellipse(..., -10)
  • ellipse(..., -100)

All resulted in crash.

I'm willing to implement a fix if this gets approved.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no files or tests. Start by running the provided WEBGL sketch with negative detail values (-1, -10, and -100), then trace ellipse() through the rendering path; done means those inputs no longer crash the renderer and the behavior is covered by regression testing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.