Skip to content

Simplify indexing bug #386

@evetion

Description

@evetion

results = Vector{Int}(undef, max_points + (preserve_endpoint ? 0 : 1))
results[1], results[2] = 1, npoints
# Loop through points until stopping criteria are fulfilled
i = 2 # already have first and last point added
start_idx, end_idx = 1, npoints
max_idx, max_dist = _find_max_squared_dist(points, start_idx, end_idx)
while i min(MIN_POINTS + 1, max_points) || (i < max_points && max_dist > max_tol)
# Add next point to results
i += 1
results[i] = max_idx

In the referenced lines, the i+=1 can cause a BoundsError in the line below it, as the while loop allows for max_points number. I hit this during a normal simplify(x, tol=y) operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions