Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: hax/haxlib.cc

Issue 2269013002: example failure for UncheckedMalloc + DSO Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Linker script Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « hax/hax.lst ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « hax/hax.lst ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698