Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
106f260d18 | ||
|
|
7b2087e449 |
No files matched your search
@@ -38,7 +38,12 @@ export const classifySwiftSymbol = (
|
||||
let category: SwiftTypeCategory | null = null;
|
||||
for (;;) {
|
||||
const end = identifierEnd(mangling, offset);
|
||||
if (end === undefined) break;
|
||||
if (end === undefined) {
|
||||
// A word-substituted or punycode identifier (`0…`) may name a nested
|
||||
// type of any kind, so the enclosing nominal no longer decides it.
|
||||
if (mangling.charAt(offset) === "0") category = null;
|
||||
break;
|
||||
}
|
||||
const kind = mangling.charAt(end);
|
||||
const nominal = NOMINAL_CATEGORIES.get(kind);
|
||||
if (nominal === undefined) {
|
||||
|
||||
@@ -28,6 +28,10 @@ describe("modern Swift category evidence", () => {
|
||||
"$sSi4mainE7doubledSiyF",
|
||||
"$s9999999999999999999999BadVMa",
|
||||
"$s4main04PairVMa",
|
||||
// Nested types named by punycode identifiers inside struct Envelope.
|
||||
"_$s6Nested8EnvelopeV007IhuqBAbO8describeSSyF",
|
||||
"_$s6Nested8EnvelopeV007jvrtDBlCAEycfC",
|
||||
"_$s6Nested8EnvelopeV007jvrtDBlCMa",
|
||||
];
|
||||
const result = categorizeSwiftTypes(
|
||||
names.map((name, index) => ({ address: String(index), name })),
|
||||
@@ -52,6 +56,16 @@ describe("modern Swift category evidence", () => {
|
||||
).toMatchObject({ total: 0, unclassified: [] });
|
||||
});
|
||||
|
||||
it("keeps a nested punycode class unresolved under a class filter", () => {
|
||||
const name = "_$s6Nested8EnvelopeV007jvrtDBlCMa";
|
||||
expect(
|
||||
categorizeSwiftTypes([{ address: "0x1", name }], { category: "classes" }),
|
||||
).toMatchObject({
|
||||
total: 0,
|
||||
unclassified: [{ name, reason: "category_not_decoded" }],
|
||||
});
|
||||
});
|
||||
|
||||
it("deduplicates display names after selecting a category", () => {
|
||||
expect(
|
||||
categorizeSwiftTypes(
|
||||
|
||||
@@ -176,7 +176,13 @@ it.each(["caller", "host"] as const)(
|
||||
);
|
||||
let closing: ReturnType<NonNullable<typeof host.close>> | undefined;
|
||||
try {
|
||||
await expect.poll(async () => (await fakeKunaCalls(kuna)).length).toBe(1);
|
||||
// The preceding Ghidra probe may prepare Darwin process ownership before
|
||||
// Kuna starts; keep startup separate from the bounded post-abort join.
|
||||
await expect
|
||||
.poll(async () => (await fakeKunaCalls(kuna)).length, {
|
||||
timeout: 10_000,
|
||||
})
|
||||
.toBe(1);
|
||||
const probe = (await fakeKunaCalls(kuna))[0];
|
||||
if (probe === undefined) throw new Error("Missing Kuna version probe");
|
||||
expect(probe.argv).toEqual(["--version"]);
|
||||
|
||||
Reference in new issue
Block a user