Source file src/runtime/mem_wasmx_test.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build wasm || wasm32
     6  
     7  package runtime_test
     8  
     9  import (
    10  	"runtime"
    11  	"testing"
    12  )
    13  
    14  func TestReserveAlignedSbrkOverflow(t *testing.T) {
    15  	align := runtime.PhysPageSize
    16  	for _, size := range []uintptr{^uintptr(0), ^uintptr(0) - align, ^uintptr(0) - align + 1} {
    17  		p, n := runtime.SysReserveAlignedSbrk(size, align)
    18  		if p != nil || n != 0 {
    19  			t.Fatalf("reserve(%#x, %#x) = (%p, %#x), want (nil, 0)", size, align, p, n)
    20  		}
    21  	}
    22  }
    23  

View as plain text