#include
#include
#include
using namespace std;
int main()
{
char *a = “hello world”;
char *b = NULL;
char *c = b;
cout << a << endl;
//cout << b << endl;
cin.get();
cin.get();
return 0;
}
sudo /home/xxxxxxxxxxxxxxx/work/xxxxxxxxxx/prebuilt/toolchains/aarch64-imx8x-linux/bin/aarch64-poky-linux-g++ -o test_crash test_crash.c
把test_crash copy 到实际验证即可
#include <stdio.h>
int main (void)
{
char *ptr = “hello”;
*ptr = ‘H’;
return 0;
}
同样也可以制造crash