diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2025-12-22 18:49:17 +0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-12-23 07:32:56 -0800 |
| commit | b6b8b2fe6ef8ceb727c7a157750cdd4e61393489 (patch) | |
| tree | 75beb69b9677b9024814d18e0d6b59e4da080f43 /src/cmd | |
| parent | 2cd0371a0a61e0dec6034239b1a92a20968c8522 (diff) | |
| download | go-b6b8b2fe6ef8ceb727c7a157750cdd4e61393489.tar.xz | |
cmd/compile: handle propagating an out-of-range jump table index
For an out-of-range jump table index, the constant facts should not be
propagated to the destinations.
Fixes #76950
Change-Id: Iff29814cb466c7aaa432cec212e5387665c45afc
Reviewed-on: https://go-review.googlesource.com/c/go/+/731860
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/compile/internal/ssa/sccp.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/sccp.go b/src/cmd/compile/internal/ssa/sccp.go index 9b958d0454..7ef8d6b7c1 100644 --- a/src/cmd/compile/internal/ssa/sccp.go +++ b/src/cmd/compile/internal/ssa/sccp.go @@ -507,6 +507,10 @@ func (t *worklist) propagate(block *Block) { branchIdx = 1 - condLattice.val.AuxInt } else { branchIdx = condLattice.val.AuxInt + if branchIdx < 0 || branchIdx >= int64(len(block.Succs)) { + // unreachable code, do nothing then + break + } } t.edges = append(t.edges, block.Succs[branchIdx]) } else { |
