Source file
test/fixedbugs/issue80517_1.go
1
2
3
4
5
6
7 package main
8
9 const targetPC = uintptr(0xdeadbeef)
10
11 type payload struct {
12 x uintptr
13 y *uintptr
14 fn [2]func()
15 }
16
17 var p payload
18 var v []byte
19
20 func init() {
21 p.x = targetPC
22 p.y = &p.x
23 p.fn[0] = func() {}
24 p.fn[1] = func() {}
25 }
26
27
28 func trigger(n int) {
29 defer func() { recover() }()
30
31 if n < len(p.fn) {
32 p.fn[n&1]()
33
34 s := make([]byte, n)
35 v = s
36 }
37 }
38
39 func main() {
40 trigger(-1)
41 }
42
View as plain text