File: test-segfault.c

package info (click to toggle)
dbus 1.0.2-1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 7,100 kB
  • ctags: 4,346
  • sloc: ansic: 65,805; sh: 8,901; xml: 6,705; makefile: 515
file content (25 lines) | stat: -rwxr-xr-x 360 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* This is simply a process that segfaults */
#include <stdlib.h>
#include <signal.h>

#include <sys/time.h>
#include <sys/resource.h>

int
main (int argc, char **argv)
{
  char *p;  

  struct rlimit r = { 0, };
  
  getrlimit (RLIMIT_CORE, &r);
  r.rlim_cur = 0;
  setrlimit (RLIMIT_CORE, &r);
  
  raise (SIGSEGV);

  p = NULL;
  *p = 'a';
  
  return 0;
}