fix(android): validate DEX long syntax before conversion (#9909)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morlutoandCursor Agent authored and GitHub committed 2026-11-11 00:44:20 -05:00
1 parent 5c2917266d
commit abc4f0f8b2
2 files changed
+13 -3

No files matched your search

+5 -2
View File
@@ -187,8 +187,11 @@ export const dexStaticValueSchema = z.discriminatedUnion("type", [
type: z.literal("long"),
value: z
.string()
.regex(/^(?:0|-?[1-9]\d*)$/u)
.refine((text) => BigInt(text) >= LONG_MIN && BigInt(text) <= LONG_MAX),
.regex(/^(?:0|-?[1-9]\d*)$/u, { abort: true })
.refine((text) => {
const value = BigInt(text);
return value >= LONG_MIN && value <= LONG_MAX;
}),
}),
floating("float", Math.fround),
floating("double", (value) => value),
+8 -1
View File
@@ -536,6 +536,7 @@ it("reports DEX static values of static final fields without a static initialize
it.each([
{ type: "long", value: -9223372036854775808 },
{ type: "long", value: "1.5" },
{ type: "int", value: "1024" },
{ type: "double", value: 0.5 },
{ type: "enum", value: "fixture.Mode.ON" },
@@ -553,7 +554,13 @@ it.each([
dex_static_value,
},
]),
).rejects.toThrow("JADX class summary failed or was malformed");
).rejects.toMatchObject({
_tag: "AnalysisOutputError",
operation: "inspect_android_class",
message: expect.stringContaining(
"JADX class summary failed or was malformed",
),
});
},
);