]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: avoid bound check in freebsd binuptime
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 27 Oct 2025 09:47:20 +0000 (16:47 +0700)
committerGopher Robot <gobot@golang.org>
Tue, 28 Oct 2025 02:02:06 +0000 (19:02 -0700)
Fixes #76062

Change-Id: I683c1232aaeac12b0b3688472bb277adb95ad542
Reviewed-on: https://go-review.googlesource.com/c/go/+/715180
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
src/runtime/vdso_freebsd.go

index feecada03571393065d47cdef16c9c2e348e4e16..99ca1571a7a49eba200ed358b039ba9a1288ea3b 100644 (file)
@@ -54,6 +54,9 @@ func binuptime(abs bool) (bt bintime) {
                }
 
                curr := atomic.Load(&timekeepSharedPage.current) // atomic_load_acq_32
+               if curr >= uint32(len(timehands)) {
+                       return zeroBintime
+               }
                th := &timehands[curr]
                gen := atomic.Load(&th.gen) // atomic_load_acq_32
                bt = th.offset