Last active
July 20, 2018 05:34
-
-
Save niya3/43fc19709df1065482a12f79a391cffe to your computer and use it in GitHub Desktop.
simple ASAN expample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int f(){ | |
const int M = 55500; | |
//int N = M + 3; | |
int N = M - 1; | |
int *a = new int[M]; | |
a[N] = 14; | |
return a[N]; | |
} | |
int g(){ | |
return f(); | |
} | |
int main(){ | |
std::cout << g() << std::endl; | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: main | |
main: m.cpp | |
g++ -g -o $@ $^ -fsanitize=address | |
$@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment