Skip to content

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

@shuklaaryan367-byte

Description

@shuklaaryan367-byte

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions