mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
Implement string out of bounds checks
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user