Abstract


Common Causes


Indexing an Array beyond its boundary

#include <iostream>
 
int main() {
	int xs[10];
	int x = xs[100000];
 
	return 0;
}

Dereferencing Null Pointer

#include <iostream>
 
int main() {
	int *x = nullptr;
	*x = 900; // Dereferencing 
	return 0;
}

Ways to Handle


  • Use Rust, Rust checks the index with the the range the program can access, if out of range, exit immediately with helpful error message instead of continuing and cause Segmentation Fault