[p5.js 2.0 Bug Report]: ellipse() with negative detail crashes in WEBGL
Nobody has claimed this yet.
- 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:
- Create WEBGL canvas
- Call ellipse()
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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