[RESTRICT AUTOMERGE] CTS test for Android Security b/132083376

Bug: 132083376
Bug: 135208125
Test: Ran the new testcase on android-8.0.0_r30 to test with/without patch

Merged-In: Ibb1bbf1835101250c02bfd4f050aba93a76d4913
Change-Id: Ibb1bbf1835101250c02bfd4f050aba93a76d4913
diff --git a/hostsidetests/securitybulletin/AndroidTest.xml b/hostsidetests/securitybulletin/AndroidTest.xml
index e5ad02c..30f29e7 100644
--- a/hostsidetests/securitybulletin/AndroidTest.xml
+++ b/hostsidetests/securitybulletin/AndroidTest.xml
@@ -236,6 +236,7 @@
         <!--__________________-->
         <!-- Bulletin 2019-08 -->
         <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
+        <option name="push" value="CVE-2019-2134->/data/local/tmp/CVE-2019-2134" />
         <option name="push" value="CVE-2019-2126->/data/local/tmp/CVE-2019-2126" />
 
         <!--__________________-->
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2134/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2134/Android.mk
new file mode 100644
index 0000000..7802774
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2134/Android.mk
@@ -0,0 +1,40 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CVE-2019-2134
+LOCAL_SRC_FILES := poc.c
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+LOCAL_C_INCLUDES_64 := packages/apps/Nfc/nci/jni/extns/pn54x/src/mifare/
+LOCAL_C_INCLUDES_64 += packages/apps/Nfc/nci/jni/extns/pn54x/src/common/
+LOCAL_C_INCLUDES_64 += packages/apps/Nfc/nci/jni/extns/pn54x/inc/
+LOCAL_C_INCLUDES_64 += system/nfc/src/nfa/include/
+LOCAL_C_INCLUDES_64 += system/nfc/src/gki/common/
+LOCAL_C_INCLUDES_64 += system/nfc/src/include/
+LOCAL_C_INCLUDES_64 += system/nfc/src/gki/ulinux/
+LOCAL_C_INCLUDES_64 += system/nfc/src/nfc/include/
+LOCAL_C_INCLUDES_64 += system/nfc/src/hal/include/
+LOCAL_SHARED_LIBRARIES_64 := libnfc_nci_jni
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts sts vts
+LOCAL_CTS_TEST_PACKAGE := android.security.cts
+
+LOCAL_ARM_MODE := arm
+LOCAL_CFLAGS := -Wall -Werror
+include $(BUILD_CTS_EXECUTABLE)
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2134/poc.c b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2134/poc.c
new file mode 100644
index 0000000..2486239
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2134/poc.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include "../includes/common.h"
+
+//This PoC is only for 64-bit builds
+#if _64_BIT
+#include "phNxpExtns_MifareStd.h"
+#endif /* _64_BIT */
+
+int main() {
+
+//This PoC is only for 64-bit builds
+#if _64_BIT
+    uint8_t p_data = 0xA0;
+    uint32_t len = 1;
+
+    phNxpExtns_MfcModuleInit();
+    Mfc_Transceive(&p_data, len);
+#endif /* _64_BIT */
+
+    return EXIT_SUCCESS;
+}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
index 6831b1e..f46063a 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
@@ -54,6 +54,16 @@
      ******************************************************************************/
 
     /**
+     * b/132083376
+     * Vulnerability Behaviour: SIGSEGV in self
+     */
+    @Test
+    @SecurityTest(minPatchLevel = "2019-08")
+    public void testPocCVE_2019_2134() throws Exception {
+        AdbUtils.runPocAssertNoCrashesNotVulnerable("CVE-2019-2134", null, getDevice());
+    }
+
+    /**
      * b/31470908
      * Vulnerability Behaviour: SIGSEGV in self
      */