commit | a0984dcdd3066d057012c99f2cb7f01a3961d9ee | [log] [tgz] |
---|---|---|
author | Nigel Tao <nigeltao@golang.org> | Sun May 02 16:50:29 2021 +1000 |
committer | Nigel Tao <nigeltao@golang.org> | Sun May 02 16:50:29 2021 +1000 |
tree | 69d10e9efb107ca7a1a633d932862b2d3ffd34b5 | |
parent | b8f87debe3b411b8d0999e2328a1f522b5435a72 [diff] |
Limit the number of coroutines per type to 0x7FFF
diff --git a/internal/cgen/func.go b/internal/cgen/func.go index f85b1cc..eca0bed 100644 --- a/internal/cgen/func.go +++ b/internal/cgen/func.go
@@ -292,6 +292,9 @@ if n.Public() && n.Effect().Coroutine() { g.numPublicCoroutines[n.Receiver()]++ coroID = g.numPublicCoroutines[n.Receiver()] + if coroID >= 0x8000 { + return fmt.Errorf("too many coroutines for %q", n.Receiver().Str(g.tm)) + } } g.currFunk = funk{