[SECURITY-798] Update the array index calculations.