Skip to content

Commit

Permalink
Refs #11509. Create seg fault via null pointer dereference.
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumsteve committed Apr 10, 2015
1 parent f4425ce commit d932e33
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Code/Mantid/Framework/Algorithms/src/Segfault.cpp
Expand Up @@ -48,17 +48,9 @@ void Segfault::exec() {
g_log.error("Crashing mantid now");

if (!dryrun) {
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++11-compat-deprecated-writable-strings"
#pragma clang diagnostic ignored "-Wwritable-strings"
#endif
// writing to read-only memory
char *s = "hello world";
*s = 'H';
#if __clang__
#pragma clang diagnostic pop
#endif
// NULL pointer dereference
int *ptr = NULL;
*ptr = 1;
}
}

Expand Down

0 comments on commit d932e33

Please sign in to comment.