]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: refuse excessively long constants
authorRobert Griesemer <gri@golang.org>
Tue, 2 Feb 2021 21:20:03 +0000 (13:20 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 3 Feb 2021 20:22:34 +0000 (20:22 +0000)
commitc910fd7b771cfbfc1b11a6eef750f835bf66c96c
treeaf1361479316deaf3d4141034652ec423c576a51
parent3db6e18468d9e5c8f5fcfece26b5b666f86e9742
[dev.typeparams] cmd/compile: refuse excessively long constants

The compiler uses 512 bit of precision for untyped constant
arithmetic but didn't restrict the length of incoming constant
literals in any way, possibly opening the door for excessively
long constants that could bring compilation to a crawl.

Add a simple check that refuses excessively long constants.
Add test.

Change-Id: I797cb2a8e677b8da2864eb92d686d271ab8a004d
Reviewed-on: https://go-review.googlesource.com/c/go/+/289049
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/noder/noder.go
src/cmd/compile/internal/types2/expr.go
test/const7.go [new file with mode: 0644]