Last active
June 13, 2017 02:56
-
-
Save maxrp/b5f402a288b6fd37af984d9144ff1ea7 to your computer and use it in GitHub Desktop.
aslr_test c vs. nim
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 <stdio.h> | |
| #include <stdlib.h> | |
| int main() { | |
| int stack = 10; | |
| int* heap = malloc(sizeof(int)); | |
| printf("stack = %p\nheap = %p\n\n", &stack, heap); | |
| return 0; | |
| } |
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
| proc main() = | |
| var | |
| robert_stack = 10 | |
| what_a_heap = alloc(sizeof(int)) | |
| stack_addr = addr(robert_stack) | |
| heap_addr = addr(what_a_heap) | |
| echo "stack = ",repr(stack_addr), "heap = ", repr(heap_addr) | |
| main() |
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
| fn main() { | |
| let stack = 10; | |
| let heap = Box::new(std::mem::size_of::<i64>); | |
| println!("stack = {:p}\nheap = {:p}", &stack, &heap); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment