Subset of C language with tree interpreter and bytecode compiler + VM.
Nie możesz wybrać więcej, niż 25 tematów
Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
|
// use-after-free
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <assert.h>
|
|
|
|
int main() {
|
|
int *ptr = (int *)malloc(sizeof(*ptr));
|
|
assert(ptr != 0);
|
|
*ptr = 42;
|
|
printf("%d\n", *ptr);
|
|
free(ptr);
|
|
printf("%d\n", *ptr); // use after free
|
|
// the following sometimes causes a SEGV in the interpreter because the store corrupts GC memory
|
|
*ptr = 43; // use after free
|
|
printf("%d\n", *ptr); // use after free
|
|
return 0;
|
|
}
|