fork download
  1. #include <stdio.h>
  2. void func(int i);
  3. void func2(int i)
  4. {
  5. printf("in func2\n");
  6. printf("%x\n", i);
  7. printf("%x %x %x %x %x %x %x %x\n", *(&i-3), *(&i-2), *(&i-1), *(&i-0), *(&i+1), *(&i+2), *(&i+3), *(&i+4));
  8. *(&i-1) = i;
  9. printf("%x %x %x %x %x %x %x %x\n", *(&i-3), *(&i-2), *(&i-1), *(&i-0), *(&i+1), *(&i+2), *(&i+3), *(&i+4));
  10. }
  11.  
  12.  
  13. void func(int i)
  14. {
  15. int * a = __builtin_return_address (0);
  16. int * b = __builtin_return_address (1);
  17. printf("%x %x %x\n", a, b, &i);
  18. printf("%x %x %x %x %x %x %x %x\n", *(&i-3), *(&i-2), *(&i-1), *(&i-0), *(&i+1), *(&i+2), *(&i+3), *(&i+4));
  19. *(&i) = (int) a;
  20. *(&i+1) = (int) a;
  21. *(&i+2) = (int) a;
  22. *(&i-1) = (int) func2;
  23. printf("%x %x %x %x %x %x %x %x\n", *(&i-3), *(&i-2), *(&i-1), *(&i-0), *(&i+1), *(&i+2), *(&i+3), *(&i+4));
  24. }
  25. int main(void)
  26. {
  27. func(0xaaaaaaaa);
  28. return 0;
  29. }
Success #stdin #stdout 0s 2052KB
stdin
Standard input is empty
stdout
80483cb   b75d5723   bff67550
b772a000   bff67568    80483cb   aaaaaaaa    bff67614   bff6761c    b75ece4d   b772a3a4
b772a000   bff67568    80484d0   80483cb    80483cb   80483cb    b75ece4d   b772a3a4
in func2
80483cb
0   bff67568    80483cb   80483cb    80483cb   b75ece4d    b772a3a4   bff67580
0   bff67568    80483cb   80483cb    80483cb   b75ece4d    b772a3a4   bff67580