mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
![Richard Musiol](/assets/img/avatar_default.png)
CL 170950 had a regression that makes the compiler produce an invalid wasm binary if the data section is too large. Loading such a binary gives the following error: "LinkError: WebAssembly.instantiate(): data segment is out of bounds" This change fixes the issue by ensuring that the minimum size of the linear memory is larger than the end of the data section. Fixes #34395. Change-Id: I0c8629de7ffd0d85895ad31bf8c9d45fef197a57 Reviewed-on: https://go-review.googlesource.com/c/go/+/199358 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
18 lines
357 B
Go
18 lines
357 B
Go
// run
|
|
|
|
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Test that a binary with a large data section can load. This failed on wasm.
|
|
|
|
package main
|
|
|
|
var test = [100 * 1024 * 1024]byte{42}
|
|
|
|
func main() {
|
|
if test[0] != 42 {
|
|
panic("bad")
|
|
}
|
|
}
|