Skip to content

Recursion Bug #134

@mirkobitetto

Description

@mirkobitetto

Summary
A Unbounded Recursion exists in the library's centroiding logic. When processing an image with a large, contiguous region of bright pixels, a recursive helper function is called without a depth limit.


Root Cause
The core issue is the use of an unbounded recursive function to perform a flood-fill-like operation on contiguous pixels. When a large area meets the criteria, the recursion depth exceeds the stack limit.


Reproduction
This bugs can be reliably reproduced by passing a sufficiently large, uniformly bright image to the centroiding functions.


Suggested Fix
We recommend replacing the recursive implementation with an iterative traversal using an explicit stack (e.g., std::stack or std::vector). This iterative approach will gracefully handle large contiguous regions without exhausting the stack.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions