Skip to content

[examples] Fix memory out of bounds in [shapes] example - ball physics#5683

Merged
raysan5 merged 1 commit into
raysan5:masterfrom
Jopestpe:shapes_ball_physics
Mar 23, 2026
Merged

[examples] Fix memory out of bounds in [shapes] example - ball physics#5683
raysan5 merged 1 commit into
raysan5:masterfrom
Jopestpe:shapes_ball_physics

Conversation

@Jopestpe
Copy link
Copy Markdown
Contributor

Description

  • Fixes memory out of bounds in [shapes] example - ball physics by using malloc/free

Changelog

  • Modified examples/shapes/shapes_ball_physics.c - code
  • Updated examples/shapes/shapes_bouncing_ball.png – refreshed screenshot for accuracy

Update screenshot to shapes_bouncing_ball.png
@raysan5 raysan5 merged commit 22cc255 into raysan5:master Mar 23, 2026
17 checks passed
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented Mar 23, 2026

@Jopestpe Thanks for the review but... did you try it on PLATFORM_WEB?

Because this change is probably not related to the listed issue...

@Jopestpe
Copy link
Copy Markdown
Contributor Author

@Jopestpe Thanks for the review but... did you try it on PLATFORM_WEB?

Because this change is probably not related to the listed issue...

My bad, I didn't mention it earlier, I tested it on both Linux and the web. Initially, reducing MAX_BALLS to 1300 or less didn't cause the memory out of bounds since as it fits within Emscripten's STACK_SIZE (64*1024), but I preferred to move it to the heap while keeping the 5000 from the original script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants