mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 09:55:46 +00:00
fix(il2cpp): reject duplicate method tokens per image
Reject duplicate MethodDef row identities within one owning image before publishing native addresses or Ghidra seeds, while retaining cross-image reuse and folded code addresses. Fixes #6610
This commit is contained in:
1 parent
72dd48a44c
commit
139fd52477
4 files changed
+132
-17
No files matched your search
@@ -90,6 +90,25 @@ export function* linkIl2cppBinarySteps(
|
||||
methodImage[type.method_start + method] = index;
|
||||
}
|
||||
}
|
||||
const methodByImageAndRow = metadata.images.map(
|
||||
() => new Map<number, number>(),
|
||||
);
|
||||
for (let index = 0; index < methodImage.length; index++) {
|
||||
if (index % LINK_BATCH === 0) yield;
|
||||
const owner = methodImage[index]!;
|
||||
if (owner === -1) continue;
|
||||
const token = facts.methodTokens[index]!;
|
||||
const row = token & 0xffffff;
|
||||
if (token >>> 24 !== 0x06 || row === 0) continue;
|
||||
const methodsByRow = methodByImageAndRow[owner]!;
|
||||
const earlier = methodsByRow.get(row);
|
||||
if (earlier !== undefined)
|
||||
throw new Il2cppBinaryFormatFailure(
|
||||
"invalid-method-token",
|
||||
`methods ${earlier} and ${index} in image ${metadata.images[owner]!.name} share MethodDef token 0x${token.toString(16)}`,
|
||||
);
|
||||
methodsByRow.set(row, index);
|
||||
}
|
||||
yield;
|
||||
const methodAddress = (index: number): Il2cppMethodCode => {
|
||||
const owner = methodImage[index]!;
|
||||
|
||||
Reference in new issue
Block a user