Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(android): preserve malformed DEX prototype rejection (#2917)

Ysopwnabled82ad1faf0b2
diff --git a/tests/boundary/android/JadxAnalysis.test.ts b/tests/boundary/android/JadxAnalysis.test.ts
index 36b0ab9d9..ad7d0d614 100644
--- a/tests/boundary/android/JadxAnalysis.test.ts
+++ b/tests/boundary/android/JadxAnalysis.test.ts
@@ -279,26 +279,44 @@ it("preserves bounded instruction coverage separately from using-node coverage",
});
});
-it("rejects malformed method descriptors at the Android adapter boundary", async () => {
- const invalidSummary = {
- ...summary,
- methods: summary.methods.map((method) => ({
- ...method,
- dex_descriptor: "not-a-dex-descriptor",
- })),
- };
- await expect(
- analyzeJadxRequest(
- {
- json: () => Promise.resolve(invalidSummary),
- text: () => Promise.reject(new Error("unexpected text call")),
- },
- {
- operation: "inspect_android_class",
- input: { path: "/fixture.apk", class_name: "fixture.Target" },
+it.each([
+ "not-a-dex-descriptor",
+ "(Lbad(name;)V",
+ "(Lbad)name;)V",
+ "()Lbad(name;",
+ "()Lbad)name;",
+])(
+ "rejects malformed DEX prototype %s at the adapter boundary",
+ async (descriptor) => {
+ const invalidSummary = {
+ ...summary,
+ methods: summary.methods.map((method) => ({
+ ...method,
+ dex_descriptor: descriptor,
+ })),
+ };
+ await expect(
+ analyzeJadxRequest(
+ {
+ json: () => Promise.resolve(invalidSummary),
+ text: () => Promise.reject(new Error("unexpected text call")),
+ },
+ {
+ operation: "inspect_android_class",
+ input: { path: "/fixture.apk", class_name: "fixture.Target" },
+ },
+ {} as never,
+ engine,
+ ),
+ ).rejects.toMatchObject({
+ _tag: "AnalysisOutputError",
+ cause: {
+ issues: expect.arrayContaining([
+ expect.objectContaining({
+ path: ["methods", 0, "dex_descriptor"],
+ }),
+ ]),
},
- {} as never,
- engine,
- ),
- ).rejects.toThrow();
-});
+ });
+ },
+);