#include "iso_alloc.h"
#include "iso_alloc_internal.h"
#if UAF_PTR_PAGE && !ALLOC_SANITY
typedef struct test {
char *str;
} test_t;
int main(int argc, char *argv[]) {
void *str = iso_alloc(32);
test_t *test = (test_t *) iso_alloc(1024);
test->str = str;
const char *s = "a string!";
memcpy(str, s, strlen(s));
iso_free_permanently(str);
iso_alloc_root *root = _get_root();
fprintf(stdout, "Dereferencing test->str @ %p. Fault address will be %p\n", test->str, root->uaf_ptr_page);
fprintf(stdout, "[%s]\n", test->str);
iso_free_permanently(test);
return OK;
}
#else
int main(int argc, char *argv[]) {
return 0;
}
#endif