Skip to content

Fix division by zero and array bounds violations#312

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/find-logical-flaws
Draft

Fix division by zero and array bounds violations#312
Copilot wants to merge 4 commits intomasterfrom
copilot/find-logical-flaws

Conversation

Copy link

Copilot AI commented Feb 16, 2026

Systematic scan identified 6 critical safety issues causing undefined behavior or crashes with edge-case inputs.

Fixes

LatheGeometry: Division by (points.size() - 1) at line 49

  • Added points.size() >= 2 guard, early return if insufficient

AssimpLoader: Bone weight normalization divides by sum without null check

  • Guard with sum > 0.0f, fallback to uniform distribution (0.25 each) for degenerate case
  • Documents this as compatibility fallback for malformed models

Lut colormap: Three issues in color lookup table

  • Guard n <= 0 by clamping to 1 (maintains backward compatibility)
  • Protect (max - min) division with zero check
  • Clamp colorPosition to [0, n-1] preventing out-of-bounds at boundaries

SplineCurve: Boundary check allows points[intPoint + 2] out-of-bounds

  • Changed condition from > size - 3 to >= size - 2
  • Added empty points guard

SVGFunctions: Division by ay without null check

  • Added ay != 0 check, early return BEHIND for degenerate case (both ax, ay zero)

All changes are minimal guards - no functional behavior modified for valid inputs. All 28 existing tests pass.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 16, 2026 18:48
Co-authored-by: markaren <6005031+markaren@users.noreply.github.com>
…tation

Co-authored-by: markaren <6005031+markaren@users.noreply.github.com>
Co-authored-by: markaren <6005031+markaren@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix logical flaws in codebase Fix division by zero and array bounds violations Feb 16, 2026
Copilot AI requested a review from markaren February 16, 2026 18:57
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