-
-
Save b4284/e1f6111a8a23f7d1aad6cd460368d151 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <limits.h> | |
| void array_access0(void) | |
| { | |
| int a[10]; | |
| int i; | |
| for (i = 0; i < 10; ++i) { | |
| a[i] = 0; | |
| } | |
| } | |
| __attribute__((stack_protect)) void array_access1(void) | |
| { | |
| int a[10]; | |
| int i; | |
| for (i = 0; i < 10; ++i) { | |
| a[i] = 0; | |
| } | |
| } | |
| int main(int argc, char **argv) { | |
| void (*aa)(void); | |
| switch (argv[1][0]) { | |
| case '0': | |
| aa = array_access0; | |
| break; | |
| case '1': | |
| aa = array_access1; | |
| break; | |
| } | |
| for (int i = 0; i < INT_MAX / 10; ++i) { | |
| aa(); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment