refactor(il2cpp): report format failures through ParseFailure (#10701)

This commit is contained in:
morluto authored and GitHub committed 2026-11-14 21:11:29 -05:00
1 parent cd5ea9a9fb
commit 3a29b6b8ea
12 files changed
+150 -42

No files matched your search

+11 -2
View File
@@ -93,6 +93,7 @@ export function* openImageSteps(image: Buffer): Generator<void, NativeImage> {
throw new Il2cppBinaryFormatFailure(
"native-index-capacity",
cause.message,
cause.failure.limit.maximum,
);
if (cause instanceof BinaryFormatFailure)
throw new Il2cppBinaryFormatFailure(
@@ -124,8 +125,16 @@ export function* openImageSteps(image: Buffer): Generator<void, NativeImage> {
IL2CPP_BINARY_BYTES,
);
} catch (cause) {
if (cause instanceof ElfPointerRelocationFailure)
throw new Il2cppBinaryFormatFailure(cause.reason, cause.message);
if (cause instanceof ElfPointerRelocationFailure) {
if (cause.reason !== "native-index-capacity")
throw new Il2cppBinaryFormatFailure(cause.reason, cause.message);
if (cause.maximum !== undefined)
throw new Il2cppBinaryFormatFailure(
cause.reason,
cause.message,
cause.maximum,
);
}
if (cause instanceof BinaryFormatFailure)
throw new Il2cppBinaryFormatFailure("malformed-container", cause.message);
throw cause;