summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/800-smali/expected.txt5
-rw-r--r--test/800-smali/smali/b_27799205_1.smali37
-rw-r--r--test/800-smali/smali/b_27799205_2.smali37
-rw-r--r--test/800-smali/smali/b_27799205_3.smali39
-rw-r--r--test/800-smali/smali/b_27799205_4.smali39
-rw-r--r--test/800-smali/smali/b_27799205_5.smali39
-rw-r--r--test/800-smali/smali/b_27799205_helper.smali40
-rw-r--r--test/800-smali/src/Main.java9
8 files changed, 245 insertions, 0 deletions
diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt
index 8808a50f75..5a3857d07c 100644
--- a/test/800-smali/expected.txt
+++ b/test/800-smali/expected.txt
@@ -60,4 +60,9 @@ b/26594149 (7)
b/26594149 (8)
b/27148248
b/26965384
+b/27799205 (1)
+b/27799205 (2)
+b/27799205 (3)
+b/27799205 (4)
+b/27799205 (5)
Done!
diff --git a/test/800-smali/smali/b_27799205_1.smali b/test/800-smali/smali/b_27799205_1.smali
new file mode 100644
index 0000000000..92bfc80494
--- /dev/null
+++ b/test/800-smali/smali/b_27799205_1.smali
@@ -0,0 +1,37 @@
+.class public LB27799205_1;
+.super Ljava/lang/Object;
+
+# A class with an unresolved array type should not fail hard (unless it's a primitive-type access).
+
+.method public static run()V
+.registers 1
+ return-void
+.end method
+
+.method public static test([Ljava/lang/Object;[Ldo/not/resolve/K;Z)V
+.registers 6
+ # Make v0, v1 and v2 null. We'll use v0 as a merge of the inputs, v1 as null, and v2 as 0.
+ const v0, 0
+ const v1, 0
+ const v2, 0
+
+ # Conditional jump so we have a merge point.
+ if-eqz v5, :LabelSelectUnresolved
+
+:LabelSelectResolved
+ move-object v0, v3
+ goto :LabelMerged
+
+:LabelSelectUnresolved
+ move-object v0, v4
+ goto :LabelMerged
+
+:LabelMerged
+ # At this point, v0 will be the unresolved merge.
+
+ # Test aput: v0[v2] = v1.
+ aput-object v1, v0, v2
+
+ return-void
+
+.end method
diff --git a/test/800-smali/smali/b_27799205_2.smali b/test/800-smali/smali/b_27799205_2.smali
new file mode 100644
index 0000000000..e730b1e9de
--- /dev/null
+++ b/test/800-smali/smali/b_27799205_2.smali
@@ -0,0 +1,37 @@
+.class public LB27799205_2;
+.super Ljava/lang/Object;
+
+# A class with an unresolved array type should not fail hard (unless it's a primitive-type access).
+
+.method public static run()V
+.registers 1
+ return-void
+.end method
+
+.method public static test([Ljava/lang/Object;[Ldo/not/resolve/K;Z)V
+.registers 6
+ # Make v0, v1 and v2 null. We'll use v0 as a merge of the inputs, v1 as null, and v2 as 0.
+ const v0, 0
+ const v1, 0
+ const v2, 0
+
+ # Conditional jump so we have a merge point.
+ if-eqz v5, :LabelSelectUnresolved
+
+:LabelSelectResolved
+ move-object v0, v3
+ goto :LabelMerged
+
+:LabelSelectUnresolved
+ move-object v0, v4
+ goto :LabelMerged
+
+:LabelMerged
+ # At this point, v0 will be the unresolved merge.
+
+ # Test aput: v0[v2] = v1.
+ aput v1, v0, v2
+
+ return-void
+
+.end method
diff --git a/test/800-smali/smali/b_27799205_3.smali b/test/800-smali/smali/b_27799205_3.smali
new file mode 100644
index 0000000000..1cb025ed79
--- /dev/null
+++ b/test/800-smali/smali/b_27799205_3.smali
@@ -0,0 +1,39 @@
+.class public LB27799205_3;
+.super Ljava/lang/Object;
+
+# A class with an unresolved array type should not fail hard (unless it's a primitive-type access).
+# Make sure that merging is pro-active.
+
+.method public static run()V
+.registers 1
+ return-void
+.end method
+
+# Use some non-object non-array input (non-Object because the merge should be Object).
+.method public static test(Ljava/lang/Integer;[Ldo/not/resolve/K;Z)V
+.registers 6
+ # Make v0, v1 and v2 null. We'll use v0 as a merge of the inputs, v1 as null, and v2 as 0.
+ const v0, 0
+ const v1, 0
+ const v2, 0
+
+ # Conditional jump so we have a merge point.
+ if-eqz v5, :LabelSelectUnresolved
+
+:LabelSelectResolved
+ move-object v0, v3
+ goto :LabelMerged
+
+:LabelSelectUnresolved
+ move-object v0, v4
+ goto :LabelMerged
+
+:LabelMerged
+ # At this point, v0 should be Object.
+
+ # Test aput-object: v0[v2] = v1. Should fail for v0 not being an array.
+ aput-object v1, v0, v2
+
+ return-void
+
+.end method
diff --git a/test/800-smali/smali/b_27799205_4.smali b/test/800-smali/smali/b_27799205_4.smali
new file mode 100644
index 0000000000..e42951ac91
--- /dev/null
+++ b/test/800-smali/smali/b_27799205_4.smali
@@ -0,0 +1,39 @@
+.class public LB27799205_4;
+.super Ljava/lang/Object;
+
+# A class with an unresolved array type should not fail hard (unless it's a primitive-type access).
+# Make sure that merging is pro-active.
+
+.method public static run()V
+.registers 1
+ return-void
+.end method
+
+# Use some primitive-type array input.
+.method public static test([I[Ldo/not/resolve/K;Z)V
+.registers 6
+ # Make v0, v1 and v2 null. We'll use v0 as a merge of the inputs, v1 as null, and v2 as 0.
+ const v0, 0
+ const v1, 0
+ const v2, 0
+
+ # Conditional jump so we have a merge point.
+ if-eqz v5, :LabelSelectUnresolved
+
+:LabelSelectResolved
+ move-object v0, v3
+ goto :LabelMerged
+
+:LabelSelectUnresolved
+ move-object v0, v4
+ goto :LabelMerged
+
+:LabelMerged
+ # At this point, v0 should be Object.
+
+ # Test aput-object: v0[v2] = v1. Should fail for v0 not being an array.
+ aput-object v1, v0, v2
+
+ return-void
+
+.end method
diff --git a/test/800-smali/smali/b_27799205_5.smali b/test/800-smali/smali/b_27799205_5.smali
new file mode 100644
index 0000000000..6c7b18331a
--- /dev/null
+++ b/test/800-smali/smali/b_27799205_5.smali
@@ -0,0 +1,39 @@
+.class public LB27799205_5;
+.super Ljava/lang/Object;
+
+# A class with an unresolved array type should not fail hard (unless it's a primitive-type access).
+# Make sure that merging is pro-active.
+
+.method public static run()V
+.registers 1
+ return-void
+.end method
+
+# Use some non-resolvable non-array type.
+.method public static test(Ldo/not/resolve/L;[Ldo/not/resolve/K;Z)V
+.registers 6
+ # Make v0, v1 and v2 null. We'll use v0 as a merge of the inputs, v1 as null, and v2 as 0.
+ const v0, 0
+ const v1, 0
+ const v2, 0
+
+ # Conditional jump so we have a merge point.
+ if-eqz v5, :LabelSelectUnresolved
+
+:LabelSelectResolved
+ move-object v0, v3
+ goto :LabelMerged
+
+:LabelSelectUnresolved
+ move-object v0, v4
+ goto :LabelMerged
+
+:LabelMerged
+ # At this point, v0 should be Object.
+
+ # Test aput-object: v0[v2] = v1. Should fail for v0 not being an array.
+ aput-object v1, v0, v2
+
+ return-void
+
+.end method
diff --git a/test/800-smali/smali/b_27799205_helper.smali b/test/800-smali/smali/b_27799205_helper.smali
new file mode 100644
index 0000000000..145c93db38
--- /dev/null
+++ b/test/800-smali/smali/b_27799205_helper.smali
@@ -0,0 +1,40 @@
+.class public LB27799205Helper;
+.super Ljava/lang/Object;
+
+# Helper for B27799205. Reflection tries to resolve all types. That's bad for intentionally
+# unresolved types. It makes it harder to distinguish what kind of error we got.
+
+.method public static run1()V
+.registers 1
+ invoke-static {}, LB27799205_1;->run()V
+
+ return-void
+.end method
+
+.method public static run2()V
+.registers 1
+ invoke-static {}, LB27799205_2;->run()V
+
+ return-void
+.end method
+
+.method public static run3()V
+.registers 1
+ invoke-static {}, LB27799205_3;->run()V
+
+ return-void
+.end method
+
+.method public static run4()V
+.registers 1
+ invoke-static {}, LB27799205_4;->run()V
+
+ return-void
+.end method
+
+.method public static run5()V
+.registers 1
+ invoke-static {}, LB27799205_5;->run()V
+
+ return-void
+.end method
diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java
index 4e6de46caa..20c306589f 100644
--- a/test/800-smali/src/Main.java
+++ b/test/800-smali/src/Main.java
@@ -164,6 +164,15 @@ public class Main {
null));
testCases.add(new TestCase("b/26965384", "B26965384", "run", null, new VerifyError(),
null));
+ testCases.add(new TestCase("b/27799205 (1)", "B27799205Helper", "run1", null, null, null));
+ testCases.add(new TestCase("b/27799205 (2)", "B27799205Helper", "run2", null,
+ new VerifyError(), null));
+ testCases.add(new TestCase("b/27799205 (3)", "B27799205Helper", "run3", null,
+ new VerifyError(), null));
+ testCases.add(new TestCase("b/27799205 (4)", "B27799205Helper", "run4", null,
+ new VerifyError(), null));
+ testCases.add(new TestCase("b/27799205 (5)", "B27799205Helper", "run5", null,
+ new VerifyError(), null));
}
public void runTests() {