add checking of numeric indices to an array to see if they can reasonably be considered integers. Avoid undefined behaviour if out of bounds
convert range bounds to integers in a way that avoids undefined behaviour
Merge pull request #239 from DRMacIver/overflows

Avoid undefined behaviour with large array indices