clean up ubsan warnings
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 20df99b..ed7ff63 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -14,6 +14,12 @@
 
 # Stuck into a variable (with a space on the end) to make disabling it easy.
     'ccache': '<!(which ccache) ',
+
+    'disable_sanitizers': [
+      # Bad alignment is just slow on x86 and traps on ARM, so we'll find
+      # it other ways, and some x86 code does it on purpose.
+      'alignment',
+    ],
   },
   'conditions': [
     ['PLATFORM=="crio"', {
@@ -81,15 +87,20 @@
         'target_defaults': {
           'cflags': [
             '-fsanitize=<(SANITIZER)',
-            # TODO(brians): Figure out how to blacklist some bits of other
-            # people's code (ie stdlibc++...) and then have it abort on failure.
-            #'-fsanitize=undefined,integer',
           ],
           'ldflags': [
             '-fsanitize=<(SANITIZER)',
           ],
         },
       },
+    ], ['SANITIZER!="none" and COMPILER!="gcc"', {
+        'target_defaults': {
+          'cflags': [
+            '-fno-sanitize-recover',
+            '-fno-sanitize=<!(echo <(disable_sanitizers) | sed "s/ /,/g")',
+          ],
+        },
+      },
     ], ['SANITIZER_FPIE!=""', {
         'target_defaults': {
           'cflags': [
diff --git a/aos/build/build.py b/aos/build/build.py
index f6b4949..b36caed 100755
--- a/aos/build/build.py
+++ b/aos/build/build.py
@@ -506,17 +506,6 @@
 """We don't have all of the libraries instrumented which leads to lots of false
   errors with msan (especially stdlibc++).
   TODO(brians): Figure out a way to deal with it."""),
-      'undefined': (False,
-"""There are several warnings in other people's code that ubsan catches.
-  The following have been verified non-interesting:
-    include/c++/4.8.2/array:*: runtime error: reference binding to null pointer
-        of type 'int'
-      This happens with ::std::array<T, 0> and it doesn't seem to cause any
-        issues.
-    output/downloaded/eigen-3.2.1/Eigen/src/Core/util/Memory.h:782:*: runtime
-        error: load of misaligned address 0x* for type 'const int', which
-        requires 4 byte alignment
-      That's in the CPUID detection code which only runs on x86."""),
   }
   PIE_SANITIZERS = ('memory', 'thread')
 
diff --git a/bbb_cape/src/bbb/packet_finder_test.cc b/bbb_cape/src/bbb/packet_finder_test.cc
index 53d9bbb..bd64957 100644
--- a/bbb_cape/src/bbb/packet_finder_test.cc
+++ b/bbb_cape/src/bbb/packet_finder_test.cc
@@ -81,9 +81,19 @@
     }
     EXPECT_FALSE(packet_finder.ReadPacket(::aos::time::Time(0, 0)));
   }
+
   template <typename Data>
   void ReceivePackets(const Data &data, int packets) {
-    ReceivePackets(data, packets, ::std::array<int, 0>());
+    // Not implemented as calling the overload with expected_failures because
+    // ubsan doesn't like stdlibc++'s std::array (at least for now) and this is
+    // really simple.
+    TestByteReader reader(data);
+    PacketFinder packet_finder(&reader, 144);
+    for (int i = 1; i < packets; ++i) {
+      SCOPED_TRACE("packet " + ::std::to_string(i));
+      EXPECT_TRUE(packet_finder.ReadPacket(::aos::time::Time(0, 0)));
+    }
+    EXPECT_FALSE(packet_finder.ReadPacket(::aos::time::Time(0, 0)));
   }
 };