Implement string out of bounds checks

This commit is contained in:
Ayke van Laethem
2018-04-21 00:26:45 +02:00
parent db66039dfe
commit 1f0651c84c
2 changed files with 38 additions and 12 deletions
+9
View File
@@ -56,3 +56,12 @@ func _panic(message interface{}) {
printnl()
C.exit(1)
}
func boundsCheck(s string, outOfRange bool) {
if outOfRange {
// printstring() here is safe as this function is excluded from bounds
// checking.
printstring("panic: runtime error: index out of range\n")
C.exit(1)
}
}