]> Cypherpunks repositories - gostls13.git/commit
cmd/go: do not append to the global cfg.OrigEnv slice
authorBryan C. Mills <bcmills@google.com>
Thu, 26 Mar 2020 02:24:44 +0000 (22:24 -0400)
committerBryan C. Mills <bcmills@google.com>
Thu, 26 Mar 2020 19:02:17 +0000 (19:02 +0000)
commitbfb1342a40216cba0ff5ae3a1b102823b7603068
tree621954ebed7dbf45e70acd2312c07f8868657a80
parent918d4d46cd17192a81a6aced57d09827560ad9f0
cmd/go: do not append to the global cfg.OrigEnv slice

Appending to a global slice is only safe if its length is already
equal to its capacity. That property is not guaranteed for slices in
general, and empirically does not hold for this one.

This is a minimal fix to make it easier to backport.
A more robust cleanup of the base.EnvForDir function will be sent in a
subsequent CL.

Fixes #38077
Updates #37940

Change-Id: I731d5bbd0e516642c2cf43e713eeea15402604e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/225577
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/generate/generate.go
src/cmd/go/internal/test/test.go