mirror of
https://github.com/golang/go
synced 2024-11-19 03:54:42 -07:00
cmd/yacc: Prevent index out of range. Fixes #9099.
Change-Id: I7ef01a738b6ca49af1c148146d439c81b0a33b16 Reviewed-on: https://go-review.googlesource.com/1785 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
ddd666b122
commit
a034e478a7
@ -3400,6 +3400,13 @@ $$default:
|
||||
_ = $$pt // guard against "declared and not used"
|
||||
|
||||
$$p -= $$R2[$$n]
|
||||
// $$p is now the index of $0. Perform the default action. Iff the
|
||||
// reduced production is ε, $1 is possibly out of range.
|
||||
if $$p+1 >= len($$S) {
|
||||
nyys := make([]$$SymType, len($$S)*2)
|
||||
copy(nyys, $$S)
|
||||
$$S = nyys
|
||||
}
|
||||
$$VAL = $$S[$$p+1]
|
||||
|
||||
/* consult goto table to find next state */
|
||||
|
Loading…
Reference in New Issue
Block a user