Last active
May 6, 2017 23:37
-
-
Save iamahuman/886286ca8679f5dd040776d87d758a1a to your computer and use it in GitHub Desktop.
/home/angr/binaries/tests_src/test_memory.c
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
/* | |
* gcc -c -fzero-initialized-in-bss -o test_memory.o test_memory.c | |
*/ | |
int common_test[8]; | |
int bss_test[8] = {0}; | |
int data_test[8] = {-1, -2, -3, -4, -5, -6, -7, -8}; | |
const char rodata_test[8] = "Sample!"; | |
int main(void) { | |
if (common_test[0] || common_test[1] | |
|| common_test[2] || common_test[3] | |
|| common_test[4] || common_test[5] | |
|| common_test[6] || common_test[7]) | |
return 1; | |
if (bss_test[0] || bss_test[1] | |
|| bss_test[2] || bss_test[3] | |
|| bss_test[4] || bss_test[5] | |
|| bss_test[6] || bss_test[7]) | |
return 2; | |
if (data_test[0] != -1 || data_test[1] != -2 | |
|| data_test[2] != -3 || data_test[3] != -4 | |
|| data_test[4] != -5 || data_test[5] != -6 | |
|| data_test[6] != -7 || data_test[7] != -8) | |
return 3; | |
if (rodata_test[0] != 'S' || rodata_test[1] != 'a' | |
|| rodata_test[2] != 'm' || rodata_test[3] != 'p' | |
|| rodata_test[4] != 'l' || rodata_test[5] != 'e' | |
|| rodata_test[6] != '!' || rodata_test[7] != 0) | |
return 4; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment