| OLD | NEW |
| (Empty) | |
| 1 #include "base/logging.h" |
| 2 #include "base/process/memory.h" |
| 3 |
| 4 extern "C" void* tc_malloc(); |
| 5 |
| 6 extern "C" void __attribute__((visibility("default"))) Hax() { |
| 7 void* ptr; |
| 8 |
| 9 printf("DSO malloc: %p\n", &malloc); |
| 10 printf("DSO tc_malloc: %p\n", &tc_malloc); |
| 11 printf("DSO free: %p\n", &free); |
| 12 printf("DSO UncheckedMalloc: %p\n", &base::UncheckedMalloc); |
| 13 |
| 14 // Normal malloc/free - no problems |
| 15 ptr = malloc(64); |
| 16 free(ptr); |
| 17 |
| 18 // Unchecked malloc/free - problems! |
| 19 CHECK(base::UncheckedMalloc(42, &ptr)); |
| 20 free(ptr); |
| 21 } |
| OLD | NEW |