From b5c3fe8fac846e9e586f2c0454c1036099adaf27 Mon Sep 17 00:00:00 2001
From: Thurston Hou Yeen Dang <thurston@google.com>
Date: Wed, 1 Jun 2016 11:02:29 -0700
Subject: [PATCH] Unsigned integer overflow sanitization for netd/server

Enable unsigned-integer-overflow sanitization for netd/server
(libnetdaidl, netd, ndc).

This does not cause any aborts on CtsNetTestCases (includes
android.net.cts.VpnServiceTest), CtsNetTestCasesLegacyApi22, and
CtsNetTestCasesLegacyPermission22.
(Some tests are finicky and need to be re-run individually to pass; there is similar behavior on the unsanitized build.)

Change-Id: I021bae3cf20df7669822977d3221a44f207614a8
---
 server/Android.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/server/Android.mk b/server/Android.mk
index 04b626f0..0c848e54 100644
--- a/server/Android.mk
+++ b/server/Android.mk
@@ -21,6 +21,7 @@ include $(CLEAR_VARS)
 
 LOCAL_CFLAGS := -Wall -Werror
 LOCAL_CLANG := true
+LOCAL_SANITIZE := unsigned-integer-overflow
 LOCAL_MODULE := libnetdaidl
 LOCAL_SHARED_LIBRARIES := \
         libbinder \
@@ -47,6 +48,7 @@ LOCAL_C_INCLUDES := \
 
 LOCAL_CLANG := true
 LOCAL_CPPFLAGS := -std=c++11 -Wall -Werror
+LOCAL_SANITIZE := unsigned-integer-overflow
 LOCAL_MODULE := netd
 
 LOCAL_INIT_RC := netd.rc
@@ -134,6 +136,7 @@ include $(BUILD_EXECUTABLE)
 include $(CLEAR_VARS)
 
 LOCAL_CFLAGS := -Wall -Werror
+LOCAL_SANITIZE := unsigned-integer-overflow
 LOCAL_CLANG := true
 LOCAL_MODULE := ndc
 LOCAL_SHARED_LIBRARIES := libcutils