• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2021 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
5package main
6
7/*
8#include <stdlib.h>
9#include <stdio.h>
10
11void test(int* a) {
12	// Access Go pointer out of bounds.
13	a[3] = 300;          // BOOM
14	// We shouldn't get here; asan should stop us first.
15	printf("a[3]=%d\n", a[3]);
16}*/
17import "C"
18
19func main() {
20	var cIntArray [2]C.int
21	C.test(&cIntArray[0]) // cIntArray is moved to heap.
22}
23