Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out-of-bounds error on new_replace_table #64

Commits on Aug 3, 2023

  1. Fix out-of-bounds error on new_replace_table

    The `for i in 0..new_replace_table.len() - 1` loop gave me an "index out
    of bounds: the len is 0 but the index is 0" run-time error.  The problem
    is that the subtraction underflows when the length of the vector is
    zero, since the LHS is of type `usize`.  (The underflow would lead to an
    "attempt to subtract with overflow" run-time error with debug builds but
    not with release builds.)
    
    This commit fixes the problem by using `.windows(2)` to get an iterator
    over overlapping subslices of length two.
    andreaskurth committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    8158918 View commit details
    Browse the repository at this point in the history