| Index: hax/haxlib.cc
|
| diff --git a/hax/haxlib.cc b/hax/haxlib.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a4cd0f6f01ae18736930bb0364b9e2acc5b89086
|
| --- /dev/null
|
| +++ b/hax/haxlib.cc
|
| @@ -0,0 +1,21 @@
|
| +#include "base/logging.h"
|
| +#include "base/process/memory.h"
|
| +
|
| +extern "C" void* tc_malloc();
|
| +
|
| +extern "C" void __attribute__((visibility("default"))) Hax() {
|
| + void* ptr;
|
| +
|
| + printf("DSO malloc: %p\n", &malloc);
|
| + printf("DSO tc_malloc: %p\n", &tc_malloc);
|
| + printf("DSO free: %p\n", &free);
|
| + printf("DSO UncheckedMalloc: %p\n", &base::UncheckedMalloc);
|
| +
|
| +// Normal malloc/free - no problems
|
| + ptr = malloc(64);
|
| + free(ptr);
|
| +
|
| + // Unchecked malloc/free - problems!
|
| + CHECK(base::UncheckedMalloc(42, &ptr));
|
| + free(ptr);
|
| +}
|
|
|