An array index out-of-bounds panic is a bug class that occurs in Rust when a program tries to access an array element that does not exist. This bug can cause your program to crash or behave unexpectedly.
Issues of this type interrupt the normal execution of a program, causing it to crash or putting it into an inconsistent state. Therefore, this issue might impact the availability and reliability of your application, or even result in data loss.
If the computation of an index value is tied to user input data, this issue can potentially even be exploited by attackers to disrupt your application.
To fix an array index out of bounds panic in Rust, you should always ensure that you are accessing array elements within the bounds of the array.
let x = [1, 2, 3, 4]; x[9]; // Out of bounds indexing
let x = [1, 2, 3, 4]; x[0];