mirror of
https://github.com/golang/go
synced 2024-11-17 01:44:52 -07:00
142c002ee7
The wasm_exec.js wrapper tries to set up the argv and envp following the UNIX conventions, but doesn't get it quite right, which can cause runtime.goenv to crash if you get unlucky. The main problem was that the envp array wasn't terminated with a nil pointer, so the runtime didn't know when to stop reading the array. This CL adds that nil pointer to the end of the envp array. The other problem was harmless, but confusing. In the UNIX convention, the argv array consists of argc pointers followed by a nil pointer, followed by the envp array. However, wasm_exec.js put the environment variable count between the two pointer arrays rather than a nil pointer. The runtime never looks at this slot, so it didn't matter, but the break from convention left Cherry and I trying to debug why it *wasn't* losing any environment variables before we realized that that layouts happened to be close enough to work. This CL switches to the UNIX convention of simply terminating the argv array with a nil pointer. Change-Id: Ic9a4cd9eabb5dfa599a809b960f9e579b9f1f4db Reviewed-on: https://go-review.googlesource.com/c/go/+/193417 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Richard Musiol <neelance@gmail.com> |
||
---|---|---|
.. | ||
android | ||
arm | ||
cgo | ||
chrome/gophertool | ||
ios | ||
linkcheck | ||
nacl | ||
reboot | ||
swig | ||
trace | ||
wasm | ||
benchcmp | ||
editors | ||
go.mod |