diff options
author | Jianping Yu <jianpingy@google.com> | 2019-07-16 14:34:47 -0700 |
---|---|---|
committer | Jianping Yu <jianpingy@google.com> | 2019-08-13 20:17:03 +0000 |
commit | 581f03d39c94883a1795e0798563f31611ce1dd6 (patch) | |
tree | 2f0979f21b4ee99689a4353a7fb45a317ba81661 | |
parent | c4079eba85d912d5d8f52313b91dad6889f08e26 (diff) | |
download | cts-581f03d39c94883a1795e0798563f31611ce1dd6.tar.gz |
STS test fix for Android Security CVE-2017-0334
Test: cts-tradefed run cts -m CtsSecurityBulletinHostTestCases -t
android.security.cts.Poc17_03#testPocCVE_2017_0334
Bug: 72461237
Bug: 33245849
Change-Id: Ia58be7884ed436427c513ab917c6d3b1638d8f2e
-rw-r--r-- | hostsidetests/securitybulletin/src/android/security/cts/Poc17_03.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_03.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_03.java index 023988398d3..3023a0ae140 100644 --- a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_03.java +++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_03.java @@ -17,6 +17,7 @@ package android.security.cts; import android.platform.test.annotations.SecurityTest; +import java.util.concurrent.Callable; public class Poc17_03 extends SecurityTestCase { @@ -65,9 +66,26 @@ public class Poc17_03 extends SecurityTestCase { @SecurityTest(minPatchLevel = "2017-03") public void testPocCVE_2017_0334() throws Exception { if (containsDriver(getDevice(), "/dev/dri/renderD129")) { - String out = AdbUtils.runPoc("CVE-2017-0334", getDevice()); - assertNotMatchesMultiLine("Leaked ptr is (0x[fF]{6}[cC]0[a-fA-F0-9]{8}" - +"|0x[c-fC-F][a-fA-F0-9]{7})",out); + String out = AdbUtils.runPoc("CVE-2017-0334", getDevice()); + // info leak sample + // "leaked ptr is 0xffffffc038ed1980" + String[] lines = out.split("\n"); + String pattern = "Leaked ptr is 0x"; + assertNotKernelPointer(new Callable<String>() { + int index = 0; + @Override + public String call() { + for (; index < lines.length; index++) { + String line = lines[index]; + int index = line.indexOf(pattern); + if (index == -1) { + continue; + } + return line.substring(index + pattern.length()); + } + return null; + } + }, null); } } |