aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2019-10-17 15:49:46 -0400
committerFilippo Valsorda <filippo@golang.org>2019-10-17 15:49:46 -0400
commit6a1c22797f9cf16e0098be1d618b6c49a3b9ec34 (patch)
tree7a907755eec33061e2c505793f13627c7c4609c0
parent2da1832ad4944feef8ff58ec8cca2ac5ab67cbad (diff)
parent72766093e6bd092eb18df3759055625ba8436484 (diff)
downloadgo-6a1c22797f9cf16e0098be1d618b6c49a3b9ec34.tar.gz
go-6a1c22797f9cf16e0098be1d618b6c49a3b9ec34.zip
[dev.boringcrypto.go1.13] all: merge go1.13.2 into dev.boringcrypto.go1.13
Change-Id: I4bc23a02518497f79d2f30f3516a1a9c5eeba54c
-rw-r--r--doc/devel/release.html14
-rw-r--r--src/cmd/compile/internal/ssa/poset.go39
-rw-r--r--src/cmd/compile/internal/ssa/poset_test.go4
-rw-r--r--src/crypto/dsa/dsa.go3
-rw-r--r--test/prove.go22
5 files changed, 60 insertions, 22 deletions
diff --git a/doc/devel/release.html b/doc/devel/release.html
index f83e676ff4..fc858d418b 100644
--- a/doc/devel/release.html
+++ b/doc/devel/release.html
@@ -39,6 +39,13 @@ See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.13.1">Go
1.13.1 milestone</a> on our issue tracker for details.
</p>
+<p>
+go1.13.2 (released 2019/10/17) includes security fixes to the
+<code>crypto/dsa</code> package and the compiler.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.13.2">Go
+1.13.2 milestone</a> on our issue tracker for details.
+</p>
+
<h2 id="go1.12">go1.12 (released 2019/02/25)</h2>
<p>
@@ -121,6 +128,13 @@ See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.10">Go
1.12.10 milestone</a> on our issue tracker for details.
</p>
+<p>
+go1.12.11 (released 2019/10/17) includes security fixes to the
+<code>crypto/dsa</code> package.
+See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.12.11">Go
+1.12.11 milestone</a> on our issue tracker for details.
+</p>
+
<h2 id="go1.11">go1.11 (released 2018/08/24)</h2>
<p>
diff --git a/src/cmd/compile/internal/ssa/poset.go b/src/cmd/compile/internal/ssa/poset.go
index 4ebfb89e52..cf966c924c 100644
--- a/src/cmd/compile/internal/ssa/poset.go
+++ b/src/cmd/compile/internal/ssa/poset.go
@@ -116,10 +116,10 @@ type posetNode struct {
// the nodes are different, either because SetNonEqual was called before, or because
// we know that they are strictly ordered.
//
-// It is implemented as a forest of DAGs; in each DAG, if node A dominates B,
-// it means that A<B. Equality is represented by mapping two SSA values to the same
-// DAG node; when a new equality relation is recorded between two existing nodes,
-// the nodes are merged, adjusting incoming and outgoing edges.
+// It is implemented as a forest of DAGs; in each DAG, if there is a path (directed)
+// from node A to B, it means that A<B (or A<=B). Equality is represented by mapping
+// two SSA values to the same DAG node; when a new equality relation is recorded
+// between two existing nodes,the nodes are merged, adjusting incoming and outgoing edges.
//
// Constants are specially treated. When a constant is added to the poset, it is
// immediately linked to other constants already present; so for instance if the
@@ -519,11 +519,11 @@ func (po *poset) dfs(r uint32, strict bool, f func(i uint32) bool) bool {
return false
}
-// Returns true if i1 dominates i2.
+// Returns true if there is a path from i1 to i2.
// If strict == true: if the function returns true, then i1 < i2.
// If strict == false: if the function returns true, then i1 <= i2.
// If the function returns false, no relation is known.
-func (po *poset) dominates(i1, i2 uint32, strict bool) bool {
+func (po *poset) reaches(i1, i2 uint32, strict bool) bool {
return po.dfs(i1, strict, func(n uint32) bool {
return n == i2
})
@@ -537,7 +537,7 @@ func (po *poset) findroot(i uint32) uint32 {
// storing a bitset for each root using it as a mini bloom filter
// of nodes present under that root.
for _, r := range po.roots {
- if po.dominates(r, i, false) {
+ if po.reaches(r, i, false) {
return r
}
}
@@ -560,7 +560,7 @@ func (po *poset) mergeroot(r1, r2 uint32) uint32 {
// found, the function does not modify the DAG and returns false.
func (po *poset) collapsepath(n1, n2 *Value) bool {
i1, i2 := po.values[n1.ID], po.values[n2.ID]
- if po.dominates(i1, i2, true) {
+ if po.reaches(i1, i2, true) {
return false
}
@@ -796,7 +796,7 @@ func (po *poset) Ordered(n1, n2 *Value) bool {
return false
}
- return i1 != i2 && po.dominates(i1, i2, true)
+ return i1 != i2 && po.reaches(i1, i2, true)
}
// Ordered reports whether n1<=n2. It returns false either when it is
@@ -814,8 +814,7 @@ func (po *poset) OrderedOrEqual(n1, n2 *Value) bool {
return false
}
- return i1 == i2 || po.dominates(i1, i2, false) ||
- (po.dominates(i2, i1, false) && !po.dominates(i2, i1, true))
+ return i1 == i2 || po.reaches(i1, i2, false)
}
// Equal reports whether n1==n2. It returns false either when it is
@@ -923,8 +922,8 @@ func (po *poset) setOrder(n1, n2 *Value, strict bool) bool {
// Both n1 and n2 are in the poset. This is the complex part of the algorithm
// as we need to find many different cases and DAG shapes.
- // Check if n1 somehow dominates n2
- if po.dominates(i1, i2, false) {
+ // Check if n1 somehow reaches n2
+ if po.reaches(i1, i2, false) {
// This is the table of all cases we need to handle:
//
// DAG New Action
@@ -935,7 +934,7 @@ func (po *poset) setOrder(n1, n2 *Value, strict bool) bool {
// #4: N1<X<N2 | N1<N2 | do nothing
// Check if we're in case #2
- if strict && !po.dominates(i1, i2, true) {
+ if strict && !po.reaches(i1, i2, true) {
po.addchild(i1, i2, true)
return true
}
@@ -944,8 +943,8 @@ func (po *poset) setOrder(n1, n2 *Value, strict bool) bool {
return true
}
- // Check if n2 somehow dominates n1
- if po.dominates(i2, i1, false) {
+ // Check if n2 somehow reaches n1
+ if po.reaches(i2, i1, false) {
// This is the table of all cases we need to handle:
//
// DAG New Action
@@ -1033,10 +1032,10 @@ func (po *poset) SetEqual(n1, n2 *Value) bool {
// If we already knew that n1<=n2, we can collapse the path to
// record n1==n2 (and viceversa).
- if po.dominates(i1, i2, false) {
+ if po.reaches(i1, i2, false) {
return po.collapsepath(n1, n2)
}
- if po.dominates(i2, i1, false) {
+ if po.reaches(i2, i1, false) {
return po.collapsepath(n2, n1)
}
@@ -1084,10 +1083,10 @@ func (po *poset) SetNonEqual(n1, n2 *Value) bool {
i1, f1 := po.lookup(n1)
i2, f2 := po.lookup(n2)
if f1 && f2 {
- if po.dominates(i1, i2, false) && !po.dominates(i1, i2, true) {
+ if po.reaches(i1, i2, false) && !po.reaches(i1, i2, true) {
po.addchild(i1, i2, true)
}
- if po.dominates(i2, i1, false) && !po.dominates(i2, i1, true) {
+ if po.reaches(i2, i1, false) && !po.reaches(i2, i1, true) {
po.addchild(i2, i1, true)
}
}
diff --git a/src/cmd/compile/internal/ssa/poset_test.go b/src/cmd/compile/internal/ssa/poset_test.go
index cb739d9a0c..92c818a601 100644
--- a/src/cmd/compile/internal/ssa/poset_test.go
+++ b/src/cmd/compile/internal/ssa/poset_test.go
@@ -186,7 +186,7 @@ func TestPoset(t *testing.T) {
{OrderedOrEqual, 4, 12},
{OrderedOrEqual_Fail, 12, 4},
{OrderedOrEqual, 4, 7},
- {OrderedOrEqual, 7, 4},
+ {OrderedOrEqual_Fail, 7, 4},
// Dag #1: 1<4<=7<12
{Checkpoint, 0, 0},
@@ -450,7 +450,7 @@ func TestSetEqual(t *testing.T) {
{SetOrderOrEqual, 20, 100},
{SetOrder, 100, 110},
{OrderedOrEqual, 10, 30},
- {OrderedOrEqual, 30, 10},
+ {OrderedOrEqual_Fail, 30, 10},
{Ordered_Fail, 10, 30},
{Ordered_Fail, 30, 10},
{Ordered, 10, 40},
diff --git a/src/crypto/dsa/dsa.go b/src/crypto/dsa/dsa.go
index 575314b1b4..2fc4f1f05b 100644
--- a/src/crypto/dsa/dsa.go
+++ b/src/crypto/dsa/dsa.go
@@ -279,6 +279,9 @@ func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool {
}
w := new(big.Int).ModInverse(s, pub.Q)
+ if w == nil {
+ return false
+ }
n := pub.Q.BitLen()
if n&7 != 0 {
diff --git a/test/prove.go b/test/prove.go
index 6e92b9eec2..f6dd9f0955 100644
--- a/test/prove.go
+++ b/test/prove.go
@@ -853,6 +853,28 @@ func unrollIncMin(a []int) int {
return x
}
+// Ensure that bounds checks with negative indexes are not incorrectly removed.
+func negIndex() {
+ n := make([]int, 1)
+ for i := -1; i <= 0; i++ { // ERROR "Induction variable: limits \[-1,0\], increment 1$"
+ n[i] = 1
+ }
+}
+func negIndex2(n int) {
+ a := make([]int, 5)
+ b := make([]int, 5)
+ c := make([]int, 5)
+ for i := -1; i <= 0; i-- {
+ b[i] = i
+ n++
+ if n > 10 {
+ break
+ }
+ }
+ useSlice(a)
+ useSlice(c)
+}
+
//go:noinline
func useInt(a int) {
}