File: test-segfault.c

package info (click to toggle)
dbus 1.2.24-4%2Bsqueeze3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 9,420 kB
  • ctags: 6,204
  • sloc: ansic: 72,608; sh: 10,562; xml: 6,322; makefile: 640; python: 72
file content (28 lines) | stat: -rw-r--r-- 412 bytes parent folder | download | duplicates (3)
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
26
27
28
/* This is simply a process that segfaults */
#include <config.h>
#include <stdlib.h>
#include <signal.h>

#ifdef HAVE_SETRLIMIT
#include <sys/resource.h>
#endif

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

#if HAVE_SETRLIMIT
  struct rlimit r = { 0, };
  
  getrlimit (RLIMIT_CORE, &r);
  r.rlim_cur = 0;
  setrlimit (RLIMIT_CORE, &r);
  
  raise (SIGSEGV);
#endif
  p = NULL;
  *p = 'a';
  
  return 0;
}