Browse Source

Patch from rubiate: disable openbsd memory protections in test-memwipe

Test-memwipe is *supposed* to invoke undefined behavior, alas.

Closes 20066.
Nick Mathewson 7 years ago
parent
commit
08d1ac4f2a
2 changed files with 11 additions and 0 deletions
  1. 5 0
      changes/ticket20066
  2. 6 0
      src/test/test-memwipe.c

+ 5 - 0
changes/ticket20066

@@ -0,0 +1,5 @@
+  o Minor features (testing):
+    - Disable memory protections on OpenBSD when testing memwipe().
+      The test deliberately invokes undefined behaviour which the
+      protections interfere with. Patch from "rubiate". Closes ticket
+      20066.

+ 6 - 0
src/test/test-memwipe.c

@@ -35,6 +35,12 @@ const char *s = NULL;
     sum += (unsigned char)buf[i];                                       \
     sum += (unsigned char)buf[i];                                       \
   }
   }
 
 
+#ifdef __OpenBSD__
+/* Disable some of OpenBSD's malloc protections for this test. This helps
+ * us do bad things, such as access freed buffers, without crashing. */
+const char *malloc_options="sufjj";
+#endif
+
 static unsigned
 static unsigned
 fill_a_buffer_memset(void)
 fill_a_buffer_memset(void)
 {
 {