Commit a034e478 authored by Jan Mercl's avatar Jan Mercl Committed by Ian Lance Taylor

cmd/yacc: Prevent index out of range. Fixes #9099.

Change-Id: I7ef01a738b6ca49af1c148146d439c81b0a33b16
Reviewed-on: https://go-review.googlesource.com/1785Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent ddd666b1
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment