[RESTRICT AUTOMERGE] Updated CTS test for Android Security b/117556220
Bug: 117556220
Bug: 129556445
Test: Ran the new testcase on android-8.0.0_r2 with/without patch
Change-Id: I33e74cfcf910dd29c6407e6be94b2e2ed14c0fcd
(cherry picked from commit a57f6274a275cd73e88719d73909f5cdd5c94423)
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2046/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2046/Android.mk
deleted file mode 100644
index d98956b..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2046/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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-2046
-LOCAL_SRC_FILES := poc.cpp
-LOCAL_MULTILIB := 64
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-LOCAL_C_INCLUDES_64 := external/chromium-libpac/src
-LOCAL_SHARED_LIBRARIES_64 := libpac
-LOCAL_SHARED_LIBRARIES_64 += libutils
-
-# 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-2046/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2046/poc.cpp
deleted file mode 100644
index 6486cae..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2046/poc.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 <proxy_resolver_js_bindings.h>
-#include <proxy_resolver_v8.h>
-#include <sys/types.h>
-#include <utils/String16.h>
-#include <utils/String8.h>
-#include "../includes/common.h"
-
-#include <fstream>
-#include <iostream>
-
-#define TIMEOUT_IN_MILLISECONDS 5 * 60 * 1000
-
-android::String16 url("");
-android::String16 host("");
-
-class MyErrorListener : public net::ProxyErrorListener {
- public:
- virtual void AlertMessage(android::String16 alert) {
- (void)alert;
- }
-
- virtual void ErrorMessage(android::String16 error) {
- (void)error;
- }
-};
-
-int main(int argc, char *argv[]) {
- if (argc != 2) {
- return EXIT_FAILURE;
- }
- net::ProxyResolverJSBindings *bindings =
- net::ProxyResolverJSBindings::CreateDefault();
- MyErrorListener errorListener;
- net::ProxyResolverV8 resolver(bindings, &errorListener);
- android::String16 results;
-
- std::ifstream file;
- file.open(argv[1]);
- if (file.rdstate() != std::ifstream::goodbit) {
- return EXIT_FAILURE;
- }
-
- file.seekg(0, std::ios::end);
- size_t size = file.tellg();
- char* raw = (char*) calloc(size + 1, sizeof(char));
- if (!raw) {
- return EXIT_FAILURE;
- }
- file.seekg(0);
- file.read(raw, size);
- file.close();
- android::String16 script(raw);
-
- resolver.SetPacScript(script);
- time_t currentTime = start_timer();
- while (timer_active(currentTime)) {
- resolver.GetProxyForURL(url, host, &results);
- }
- free(raw);
-
- return EXIT_SUCCESS;
-}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2019_2046.java b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2019_2046.java
index 691349f..4a22c53 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2019_2046.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2019_2046.java
@@ -27,14 +27,12 @@
/**
* b/117556220
- * Vulnerability Behaviour: SIGSEGV in self
+ * Vulnerability Behaviour: SIGSEGV in pacrunner
*/
@SecurityTest(minPatchLevel = "2019-05")
@Test
public void testPocCVE_2019_2046() throws Exception {
pocPusher.only64();
- String inputFiles[] = {"cve_2019_2046.pac"};
- AdbUtils.runPocAssertNoCrashesNotVulnerable("CVE-2019-2046",
- AdbUtils.TMP_PATH + inputFiles[0], inputFiles, AdbUtils.TMP_PATH, getDevice());
+ AdbUtils.runProxyAutoConfig("cve_2019_2046", "true", getDevice());
}
}