added index out-of-bounds check to substitution function
added index out-of-bounds check to substitution function

GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script