From 8da997e446a0941dd83f11c77a8f78b84b0df5a7 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 24 Oct 2017 14:45:40 -0700 Subject: Add EffectBundleTest For more information about CTS tests, see https://source.android.com/compatibility/cts/run.html Test: CTS test, run on device Bug: 67647856 Change-Id: Ic78c31096b48b0662d3387cd921e3d4e4a37b1ea (cherry picked from commit b6c68c1798f0881b719338227e3277db703f6795) --- .../security/src/android/security/cts/EffectBundleTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/tests/security/src/android/security/cts/EffectBundleTest.java b/tests/tests/security/src/android/security/cts/EffectBundleTest.java index fb023337235..ae554941f70 100644 --- a/tests/tests/security/src/android/security/cts/EffectBundleTest.java +++ b/tests/tests/security/src/android/security/cts/EffectBundleTest.java @@ -19,6 +19,7 @@ package android.security.cts; import android.media.audiofx.AudioEffect; import android.media.audiofx.EnvironmentalReverb; import android.media.audiofx.Equalizer; +import android.media.audiofx.PresetReverb; import android.media.MediaPlayer; import android.platform.test.annotations.SecurityTest; import android.test.InstrumentationTestCase; @@ -247,6 +248,16 @@ public class EffectBundleTest extends InstrumentationTestCase { ); } + //Testing security bug: 67647856 + @SecurityTest + public void testPresetReverb_setParameter() throws Exception { + verifyZeroPVSizeRejectedForSetParameter( + AudioEffect.EFFECT_TYPE_PRESET_REVERB, new int[] { + PresetReverb.PARAM_PRESET + } + ); + } + private boolean eqSetParamProperties(int media) { MediaPlayer mp = null; Equalizer eq = null; -- cgit v1.2.3 From 7ab52a64f65e6995ba43dc4876ed263ba44daeee Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Tue, 10 Oct 2017 15:28:45 -0400 Subject: Test that createBitmap(65535,65535) throws OOME Bug: 33846679 Test: this A Java GIF decoder (e.g. FrameSequence) may attempt to create a large Bitmap (up to the maximum GIF size of 65535 x 65535). Test that we throw OOME, which corresponds to the old code when Bitmap pixel memory was allocated from Java/JNI (instead of creating a null Bitmap and then throwing a NullPointerException inside createBitmap). Merged-In: I6ab6cb7a3b3151641a9f9b02b0bfc484e0a4524b Change-Id: I6ab6cb7a3b3151641a9f9b02b0bfc484e0a4524b (cherry picked from commit 929b43e46db05edd4d0d227bddbdcf9df4fb0268) (cherry picked from commit a59b3ee79429f37033bb543bbc6270bc7a1e22e9) --- .../src/android/security/cts/BitmapTest.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/tests/security/src/android/security/cts/BitmapTest.java diff --git a/tests/tests/security/src/android/security/cts/BitmapTest.java b/tests/tests/security/src/android/security/cts/BitmapTest.java new file mode 100644 index 00000000000..6253f0a35ca --- /dev/null +++ b/tests/tests/security/src/android/security/cts/BitmapTest.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2017 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. + */ + +package android.security.cts; + +import org.junit.runner.RunWith; +import org.junit.Test; + +import android.graphics.Bitmap; +import android.platform.test.annotations.SecurityTest; +import android.support.test.runner.AndroidJUnit4; + +@SecurityTest +@RunWith(AndroidJUnit4.class) +public class BitmapTest { + /** + * Test Bitmap.createBitmap properly throws OOME on large inputs. + * + * A prior change in behavior resulted in throwing an NPE instead. + * OOME is more appropriate. + */ + @Test(expected=OutOfMemoryError.class) + public void test_33846679() { + // This size is based on the max size possible in a GIF file, + // which might be passed to createBitmap from a Java decoder. + Bitmap.createBitmap(65535, 65535, Bitmap.Config.ARGB_8888); + } +} -- cgit v1.2.3 From 3085dc8222083b80b40db25dcf287bf378d6117a Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Mon, 30 Oct 2017 11:21:00 -0700 Subject: Verify b/67737022 fix presence Verify the presence of patch for integer overflow in ACodec. Bug: 67737022 Test: ran new testcase on master with/without patch Change-Id: Ibaf76af1dd597bf99637b26a32bec0979d2bff19 (cherry picked from commit 148ad361becc7a469a7e08c13fcd37a520474718) --- tests/tests/security/res/raw/bug_67737022.mp4 | Bin 0 -> 102400 bytes .../src/android/security/cts/StagefrightTest.java | 11 +++++++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/tests/security/res/raw/bug_67737022.mp4 diff --git a/tests/tests/security/res/raw/bug_67737022.mp4 b/tests/tests/security/res/raw/bug_67737022.mp4 new file mode 100644 index 00000000000..c2136e5498b Binary files /dev/null and b/tests/tests/security/res/raw/bug_67737022.mp4 differ diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java index 4e4830470e1..ee36ca8ef4c 100644 --- a/tests/tests/security/src/android/security/cts/StagefrightTest.java +++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java @@ -416,6 +416,17 @@ public class StagefrightTest extends InstrumentationTestCase { doStagefrightTest(R.raw.bug_35467107); } + /*********************************************************** + to prevent merge conflicts, add O tests below this comment, + before any existing test methods + ***********************************************************/ + + @SecurityTest + public void testBug_67737022() throws Exception { + doStagefrightTest(R.raw.bug_67737022); + } + + private void doStagefrightTest(final int rid) throws Exception { doStagefrightTestMediaPlayer(rid); doStagefrightTestMediaCodec(rid); -- cgit v1.2.3 From 614d7dcd14dbcd55864687a6b8b4e5395efc35ca Mon Sep 17 00:00:00 2001 From: Adam Vartanian Date: Tue, 7 Nov 2017 13:56:04 +0000 Subject: Add CTS test for URI fix. Bug: 68341964 Test: cts -m CtsNetTestCases (on NYC branch) Change-Id: If532123542155ea3be281044a3ea4ca0b6cf2db5 (cherry picked from commit 880d3557229ff1b92dfa19b27638604f88ea8802) --- tests/tests/net/src/android/net/cts/UriTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/tests/net/src/android/net/cts/UriTest.java b/tests/tests/net/src/android/net/cts/UriTest.java index ab337d01837..05e826a2c45 100644 --- a/tests/tests/net/src/android/net/cts/UriTest.java +++ b/tests/tests/net/src/android/net/cts/UriTest.java @@ -109,6 +109,11 @@ public class UriTest extends AndroidTestCase { uri = Uri.parse("http://localhost"); assertEquals("localhost", uri.getHost()); assertEquals(-1, uri.getPort()); + + uri = Uri.parse("http://a:a@example.com:a@example2.com/path"); + assertEquals("a:a@example.com:a@example2.com", uri.getAuthority()); + assertEquals("example2.com", uri.getHost()); + assertEquals(-1, uri.getPort()); } public void testCompareTo() { -- cgit v1.2.3