1 /**
2  * Copyright (C) 2022 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 package android.security.cts;
17 
18 import static org.junit.Assume.*;
19 
20 import android.platform.test.annotations.AsbSecurityTest;
21 
22 import com.android.sts.common.tradefed.testtype.NonRootSecurityTestCase;
23 import com.android.sts.common.util.TombstoneUtils;
24 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
25 import com.android.tradefed.util.RunUtil;
26 
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 
30 @RunWith(DeviceJUnit4ClassRunner.class)
31 public class CVE_2022_22082 extends NonRootSecurityTestCase {
32 
33     /**
34      * CVE-2022-22082
35      */
36     @AsbSecurityTest(cveBugId = 223211217)
37     @Test
testPocCVE_2022_22082()38     public void testPocCVE_2022_22082() throws Exception {
39         /*
40          * Non StageFright test.
41          */
42         safeReboot();
43         AdbUtils.pushResource("/cve_2022_22082.dsf", "/sdcard/cve_2022_22082.dsf", getDevice());
44         TombstoneUtils.Config config = new TombstoneUtils.Config().setProcessPatterns("media.extractor");
45         try (AutoCloseable a = TombstoneUtils.withAssertNoSecurityCrashes(getDevice(), config)) {
46             AdbUtils.runCommandLine(
47                     "am start -a android.intent.action.VIEW -t audio/dsf -d"
48                             + " file:///sdcard/cve_2022_22082.dsf",
49                     getDevice());
50             RunUtil.getDefault().sleep(10000);
51         }
52     }
53 }
54