1 /** 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.security.cts; 18 19 import static org.junit.Assume.assumeFalse; 20 21 import android.platform.test.annotations.AsbSecurityTest; 22 23 import com.android.sts.common.tradefed.testtype.NonRootSecurityTestCase; 24 import com.android.sts.common.util.TombstoneUtils; 25 import com.android.sts.common.util.TombstoneUtils.Config.BacktraceFilterPattern; 26 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 27 28 import org.junit.Test; 29 import org.junit.runner.RunWith; 30 31 import java.util.Arrays; 32 import java.util.regex.Pattern; 33 34 @RunWith(DeviceJUnit4ClassRunner.class) 35 public class CVE_2020_0381 extends NonRootSecurityTestCase { 36 37 /** 38 * b/150159669 39 * Vulnerability Behaviour: SIGSEGV in self 40 */ 41 @AsbSecurityTest(cveBugId = 150159669) 42 @Test testPocCVE_2020_0381()43 public void testPocCVE_2020_0381() throws Exception { 44 assumeFalse(moduleIsPlayManaged("com.google.android.media")); 45 String binaryName = "CVE-2020-0381"; 46 String inputFiles[] = {"cve_2020_0381.xmf", "cve_2020_0381.info"}; 47 String signals[] = {TombstoneUtils.Signals.SIGSEGV}; 48 AdbUtils.pocConfig testConfig = new AdbUtils.pocConfig(binaryName, getDevice()); 49 testConfig.config = new TombstoneUtils.Config().setProcessPatterns(Pattern.compile(binaryName)) 50 .setBacktraceIncludes(new BacktraceFilterPattern("libmidiextractor", "Parse_ptbl")); 51 testConfig.config.setSignals(signals); 52 testConfig.arguments = 53 AdbUtils.TMP_PATH + inputFiles[0] + " " + AdbUtils.TMP_PATH + inputFiles[1]; 54 testConfig.inputFiles = Arrays.asList(inputFiles); 55 testConfig.inputFilesDestination = AdbUtils.TMP_PATH; 56 AdbUtils.runPocAssertNoCrashesNotVulnerable(testConfig); 57 } 58 } 59