aboutsummaryrefslogtreecommitdiff
path: root/src/bytes
diff options
context:
space:
mode:
authorZxilly <zxilly@outlook.com>2024-07-17 05:34:55 +0000
committerKeith Randall <khr@golang.org>2024-07-17 07:00:20 +0000
commit90c6558b6acef5a9b9fb8f3c35cff58423c8b00e (patch)
tree75d469070761e8adbaede69f1210e256b2407c40 /src/bytes
parent355711821eea51c6456a31ab61d0dc2e9db034f7 (diff)
downloadgo-90c6558b6acef5a9b9fb8f3c35cff58423c8b00e.tar.xz
internal/bytealg: extend memchr result correctly on wasm
The mem address should be regarded as uint32. Fixes #65571 Change-Id: Icee38d11f2d93eeca7d50b2e133159e321daeb90 GitHub-Last-Rev: c2568b104369bcf5c4d42c6281d235a52bb9675f GitHub-Pull-Request: golang/go#68400 Reviewed-on: https://go-review.googlesource.com/c/go/+/597955 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/bytes_js_wasm_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bytes/bytes_js_wasm_test.go b/src/bytes/bytes_js_wasm_test.go
new file mode 100644
index 0000000000..ad9db34318
--- /dev/null
+++ b/src/bytes/bytes_js_wasm_test.go
@@ -0,0 +1,21 @@
+// Copyright 2024 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.
+
+//go:build js && wasm
+
+package bytes_test
+
+import (
+ "bytes"
+ "testing"
+)
+
+func TestIssue65571(t *testing.T) {
+ b := make([]byte, 1<<31+1)
+ b[1<<31] = 1
+ i := bytes.IndexByte(b, 1)
+ if i != 1<<31 {
+ t.Errorf("IndexByte(b, 1) = %d; want %d", i, 1<<31)
+ }
+}