-
Notifications
You must be signed in to change notification settings - Fork 16
Description
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.