Prevent possible out of range memory access.