Out of bounds checking

Here is a relevant answer to a similar question: