Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit ce991fd

Browse files
committed
Don't range over work. Len(work) can be larger than the usable memory, so ranging is incorrect
1 parent 96257fa commit ce991fd

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

native/dlantr.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ func (impl Implementation) Dlantr(norm lapack.MatrixNorm, uplo blas.Uplo, diag b
129129
}
130130
}
131131
var max float64
132-
for _, v := range work {
132+
for i := 0; i < n; i++ {
133+
v := work[i]
133134
if math.IsNaN(v) {
134135
return math.NaN()
135136
}

testlapack/dlantr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func DlantrTest(t *testing.T, impl Dlantrer) {
6666
aDense[i*lda+i] = 1
6767
}
6868
}
69-
work := make([]float64, n)
69+
work := make([]float64, n+6)
7070
for i := range work {
7171
work[i] = rand.Float64()
7272
}

0 commit comments

Comments
 (0)