fix(limits)!: make the IL2CPP pointer index adjustable and require owned refusal limits (#14243)

* fix(limits): make the IL2CPP pointer index adjustable and name ELF note budgets in details.limit

inspect_il2cpp_metadata accepts max_native_index_bytes (default 1 GiB,
needs binary_path) for the estimated ELF virtual pointer index. The index
refusal now carries its own limit name (virtual-pointer-index-bytes) and a
details.limit naming the parameter, its effective value, default and range,
instead of a fixed ceiling with no override. The binary file allowance and
the loader's fixed capacities are unchanged.

inspect_elf_notes and inspect_elf_debug_link refusals for max_file_bytes,
the decoded section-name budget and max_entries now set details.limit. One
domain-owned bounds object per operation feeds both the schema and the limit.

Two guards keep new in-code refusal limits owned:
- scripts/verify/fixed-ceilings.mjs (run by npm run lint) requires every
  fixedAllowanceOptions, fixedProducerInputAllowance,
  artifactFixedLimitFailure or inline fixedAllowance declaration to be
  listed in fixed-ceiling-registry.json with its class (format, protocol,
  representation, derived, forwarding, or pending with an issue) and reason,
  and fails on stale entries.
- The untyped-budget-refusal architecture guard counts refusals whose only
  recovery is an authored remediationAction, with a shrink-only baseline.

Fixes #14175
Part of #14234

BREAKING CHANGE: an inspect_il2cpp_metadata refusal at the ELF pointer index
reports reported_limits.boundary "virtual-pointer-index-bytes" and
details.limit for max_native_index_bytes, and no longer carries a
details.refusal fixed_ceiling.

* fix(limits): track IL2CPP's remaining fixed allowances with the native readers

* fix(limits): run the authored-only refusal count from lint, where TypeScript is installed

The architecture guards run before npm ci in CI and must stay
dependency-free, so the AST-based count moves into fixed-ceilings.mjs with
its own shrink-only baseline and --shrink-baselines.

* fix(limits): register producer and native wrapper ceilings by the allowance they name

fixedProducerInputAllowance names its allowance in its second argument, and
fixedNativeAllowance forwards its first, so the guard now reads each helper's
allowance argument and checks the callers of both.

* fix(limits): delete the authored-only baseline when its last count is removed

reconcileBaselineFile returns delete once no count remains, but the
verifier ignored it and the next run read the file unconditionally, so
--shrink-baselines could not finish. An absent baseline now reads as empty
and shrinking removes the file.

* fix(limits): record the advertised IL2CPP input schema with max_native_index_bytes
This commit is contained in:
morluto authored and GitHub committed 2026-11-23 23:37:23 -05:00
1 parent 90d774ffed
commit 6ab595cfd6
28 files changed
+1623 -28

No files matched your search

+4
View File
@@ -83,6 +83,10 @@ export const registerIl2cppCommands = (
description:
"Also link generic method instances (Type<Args>$$Method<Args>) and include them in --ghidra-seeds; needs --binary",
},
max_native_index_bytes: {
description:
"Estimated bytes for an ELF --binary's relocated-pointer index (default 1073741824); raise when linking stops at this allowance; needs --binary",
},
},
cliOptions: {
ghidraSeeds: localPathStringSchema
+42
View File
@@ -7,6 +7,7 @@ import {
} from "../localPath.js";
import { canonicalBase64Schema } from "../stringPatterns.js";
import type { MachoSliceArchitecture } from "../apple/machoTargetSelection.js";
import type { AnalysisParameterLimit } from "../analysisSettings.js";
import { firstDeclaringTypeCycle } from "./il2cppDeclaringTypes.js";
/** The public `binary_architecture` values, in the native reader's spelling. */
@@ -25,6 +26,33 @@ export const IL2CPP_SLICE_SELECTORS = {
>;
export type Il2cppBinaryArchitecture = keyof typeof IL2CPP_SLICE_SELECTORS;
/**
* Estimated representation bytes admitted for an ELF binary's virtual pointer
* index when `max_native_index_bytes` is omitted. The index reserves a fixed
* logical charge per distinct relocated address, so this default admits
* 524,288 addresses. It is an REA admission policy, not a format limit.
*/
export const DEFAULT_IL2CPP_NATIVE_INDEX_BYTES = 1024 * 1024 * 1024;
/**
* The per-call control that bounded the ELF virtual pointer index, named by
* its contract field; each adapter names the option that sets it. The
* accounting is exact safe-integer arithmetic, so the control has no smaller
* maximum; host heap remains an independent constraint.
*/
export const il2cppNativeIndexLimit = (
effectiveBytes: number,
): AnalysisParameterLimit => ({
control_kind: "parameter",
parameter: "max_native_index_bytes",
effective_value: effectiveBytes,
unit: "bytes",
minimum: 1,
maximum: Number.MAX_SAFE_INTEGER,
default_value: DEFAULT_IL2CPP_NATIVE_INDEX_BYTES,
applies_at: "next_call",
});
/** Unsigned little-endian signature observed at file offset zero. */
export const IL2CPP_METADATA_MAGIC = 0xfab11baf;
@@ -135,6 +163,14 @@ export const inspectIl2cppMetadataInputSchema = requirePresence(
.describe(
"Also link generic method instances (genericMethodTable rows) to code addresses with Il2CppDumper-style Type<Args>$$Method<Args> names; needs binary_path",
),
max_native_index_bytes: z
.int()
.positive()
.max(Number.MAX_SAFE_INTEGER)
.optional()
.describe(
`Estimated bytes admitted for an ELF binary_path's relocated-pointer index, charged per distinct relocated address; omitted means ${String(DEFAULT_IL2CPP_NATIVE_INDEX_BYTES)} (1 GiB). Raise it on the next call when linking stops at this allowance; no restart. Host memory and the binary file allowance stay independent. Needs binary_path`,
),
}),
[
{
@@ -148,6 +184,12 @@ export const inspectIl2cppMetadataInputSchema = requirePresence(
requires: "binary_path",
message: "generic_instances links generic methods in binary_path.",
},
{
when: "max_native_index_bytes",
requires: "binary_path",
message:
"max_native_index_bytes bounds the pointer index of binary_path.",
},
],
);
+25 -6
View File
@@ -4,6 +4,11 @@ import { digestSchema } from "../digests.js";
import { absoluteLocalPathStringSchema } from "../localPath.js";
import { ELF_OBJECT_TYPE_NAMES } from "./elfNotes.js";
import { coverageStatusSchema } from "../coverage.js";
import {
DEFAULT_ELF_READ_FILE_BYTES,
MINIMUM_ELF_READ_FILE_BYTES,
type ElfReadBudgets,
} from "./elfReadBudgets.js";
const uint = z.number().int().min(0).max(0xffffffff);
const crc32Hex = z.string().regex(/^[0-9a-f]{8}$/u);
@@ -15,6 +20,20 @@ export const MAX_INSPECT_ELF_DEBUG_LINK_FILE_BYTES = 536870912;
export const MAX_INSPECT_ELF_DEBUG_LINK_ENTRIES = 256;
/** Default note entry budget; admits distribution glibc and its SystemTap probe notes. */
export const DEFAULT_INSPECT_ELF_DEBUG_LINK_ENTRIES = 128;
/** The per-call budgets `inspect_elf_debug_link` accepts, shared by its schema and refusals. */
export const ELF_DEBUG_LINK_READ_BUDGETS: ElfReadBudgets = {
max_file_bytes: {
minimum: MINIMUM_ELF_READ_FILE_BYTES,
maximum: MAX_INSPECT_ELF_DEBUG_LINK_FILE_BYTES,
default_value: DEFAULT_ELF_READ_FILE_BYTES,
},
max_entries: {
minimum: 1,
maximum: MAX_INSPECT_ELF_DEBUG_LINK_ENTRIES,
default_value: DEFAULT_INSPECT_ELF_DEBUG_LINK_ENTRIES,
},
};
/** Retained debuglink and debugaltlink file-name length. */
export const MAX_ELF_DEBUG_LINK_NAME_BYTES = 4096;
/** Retained build-id length for debugaltlink and GNU notes. */
@@ -182,16 +201,16 @@ export const inspectElfDebugLinkInputSchema = z.strictObject({
max_file_bytes: z
.number()
.int()
.min(64)
.max(MAX_INSPECT_ELF_DEBUG_LINK_FILE_BYTES)
.default(67108864)
.min(ELF_DEBUG_LINK_READ_BUDGETS.max_file_bytes.minimum)
.max(ELF_DEBUG_LINK_READ_BUDGETS.max_file_bytes.maximum)
.default(ELF_DEBUG_LINK_READ_BUDGETS.max_file_bytes.default_value)
.describe("Maximum stable artifact bytes to read (default 64 MiB)"),
max_entries: z
.number()
.int()
.min(1)
.max(MAX_INSPECT_ELF_DEBUG_LINK_ENTRIES)
.default(DEFAULT_INSPECT_ELF_DEBUG_LINK_ENTRIES)
.min(ELF_DEBUG_LINK_READ_BUDGETS.max_entries.minimum)
.max(ELF_DEBUG_LINK_READ_BUDGETS.max_entries.maximum)
.default(ELF_DEBUG_LINK_READ_BUDGETS.max_entries.default_value)
.describe(
"Maximum note entries to examine while reading GNU build-ids; an image exceeding the budget fails without partial success, and a candidate exceeding it leaves its build-id check unavailable",
),
+25 -6
View File
@@ -3,6 +3,11 @@ import { z } from "zod";
import { digestSchema } from "../digests.js";
import { jsonObjectSchema } from "../jsonValue.js";
import { absoluteLocalPathStringSchema } from "../localPath.js";
import {
DEFAULT_ELF_READ_FILE_BYTES,
MINIMUM_ELF_READ_FILE_BYTES,
type ElfReadBudgets,
} from "./elfReadBudgets.js";
const uint = z.number().int().min(0).max(0xffffffff);
const range = z.strictObject({ offset: uint, bytes: uint });
@@ -19,6 +24,20 @@ export const MAX_INSPECT_ELF_NOTE_ENTRIES = 256;
*/
export const DEFAULT_INSPECT_ELF_NOTE_ENTRIES = 128;
/** The per-call budgets `inspect_elf_notes` accepts, shared by its schema and refusals. */
export const ELF_NOTES_READ_BUDGETS: ElfReadBudgets = {
max_file_bytes: {
minimum: MINIMUM_ELF_READ_FILE_BYTES,
maximum: MAX_INSPECT_ELF_NOTE_FILE_BYTES,
default_value: DEFAULT_ELF_READ_FILE_BYTES,
},
max_entries: {
minimum: 1,
maximum: MAX_INSPECT_ELF_NOTE_ENTRIES,
default_value: DEFAULT_INSPECT_ELF_NOTE_ENTRIES,
},
};
export const ELF_NOTE_TYPE_NAMES = [
"gnu_abi_tag",
"gnu_hwcap",
@@ -130,16 +149,16 @@ export const inspectElfNotesInputSchema = z.strictObject({
max_file_bytes: z
.number()
.int()
.min(64)
.max(MAX_INSPECT_ELF_NOTE_FILE_BYTES)
.default(67108864)
.min(ELF_NOTES_READ_BUDGETS.max_file_bytes.minimum)
.max(ELF_NOTES_READ_BUDGETS.max_file_bytes.maximum)
.default(ELF_NOTES_READ_BUDGETS.max_file_bytes.default_value)
.describe("Maximum stable artifact bytes to read (default 64 MiB)"),
max_entries: z
.number()
.int()
.min(1)
.max(MAX_INSPECT_ELF_NOTE_ENTRIES)
.default(DEFAULT_INSPECT_ELF_NOTE_ENTRIES)
.min(ELF_NOTES_READ_BUDGETS.max_entries.minimum)
.max(ELF_NOTES_READ_BUDGETS.max_entries.maximum)
.default(ELF_NOTES_READ_BUDGETS.max_entries.default_value)
.describe(
"Maximum note entries to examine across every table; exceeding the budget fails without partial success",
),
@@ -772,7 +772,9 @@ it("refuses pointer workspace growth before inserting the next virtual destinati
failure: expect.objectContaining({
kind: "limit",
format: "elf-pointer-relocations",
limit: { name: "native-index-capacity", maximum: 4096 },
// The caller selected this allowance, so it names it separately
// from the loader's fixed capacities.
limit: { name: "virtual-pointer-index-bytes", maximum: 4096 },
}),
unit: "bytes",
message: expect.stringContaining("4096 estimated representation bytes"),
+16 -1
View File
@@ -31,6 +31,13 @@ import { ParseFailureError } from "../parseFailure.js";
/** The ParseFailure format of ELF loader pointer interpretation. */
export const ELF_POINTER_RELOCATION_FORMAT = "elf-pointer-relocations";
/**
* Limit name of the caller-selected virtual pointer index allowance, so a
* consumer can name its own control for it. The loader's fixed allowances keep
* `native-index-capacity` as their limit name.
*/
export const ELF_VIRTUAL_POINTER_INDEX_LIMIT = "virtual-pointer-index-bytes";
/**
* Shared loader interpretation; language adapters choose their public errors.
* The stable `reason` names the loader rule; `native-index-capacity` is a
@@ -53,6 +60,7 @@ export class ElfPointerRelocationFailure extends ParseFailureError<
message: string,
maximum: number,
unit: "entries" | "bytes",
limitName?: typeof ELF_VIRTUAL_POINTER_INDEX_LIMIT,
);
constructor(
readonly reason:
@@ -63,11 +71,12 @@ export class ElfPointerRelocationFailure extends ParseFailureError<
message: string,
maximum?: number,
unit?: "entries" | "bytes",
limitName: string = reason,
) {
const facts = { format: ELF_POINTER_RELOCATION_FORMAT, detail: message };
super(
maximum !== undefined
? { ...facts, kind: "limit", limit: { name: reason, maximum } }
? { ...facts, kind: "limit", limit: { name: limitName, maximum } }
: reason === "malformed-container"
? { ...facts, kind: "malformed" }
: {
@@ -1059,6 +1068,8 @@ class ElfVirtualWriteIndex {
readonly word: 4 | 8,
readonly little: boolean,
readonly maximumBytes: number,
/** Set when the caller selected `maximumBytes` and names its own control. */
readonly selectedLimit?: typeof ELF_VIRTUAL_POINTER_INDEX_LIMIT,
) {}
add({
address,
@@ -1077,6 +1088,7 @@ class ElfVirtualWriteIndex {
`ELF virtual pointer index exceeds ${this.maximumBytes} estimated representation bytes (${ELF_POINTER_INDEX_ENTRY_BYTES} reserved per virtual address, including lookup workspace)`,
this.maximumBytes,
"bytes",
this.selectedLimit,
);
this.#reservedBytes += ELF_POINTER_INDEX_ENTRY_BYTES;
}
@@ -1299,6 +1311,8 @@ export function* readElfPointerRelocationsSteps(
/** Value-only consumers keep input-bounded file-backed writes without per-record
* provenance, with a separate allowance for unresolved and zero-fill state.
* `maximumIndexBytes` is the caller's selected allowance: its refusal carries
* `ELF_VIRTUAL_POINTER_INDEX_LIMIT` so the caller can name its control.
*/
export function* readElfPointerValuesSteps(
bytes: Buffer,
@@ -1310,6 +1324,7 @@ export function* readElfPointerValuesSteps(
input.bits === 64 ? 8 : 4,
input.little,
maximumIndexBytes,
ELF_VIRTUAL_POINTER_INDEX_LIMIT,
);
const zeroFill = new Set<bigint>();
const steps = readElfRelocationWritesSteps(bytes, input, {
+38
View File
@@ -0,0 +1,38 @@
import type { AnalysisParameterLimit } from "../analysisSettings.js";
/** A caller-selected ELF reader budget: its schema bounds and omitted value. */
export interface ElfReadBudgetBounds {
readonly minimum: number;
readonly maximum: number;
readonly default_value: number;
}
/** The per-call read budgets an ELF note reader accepts. */
export interface ElfReadBudgets {
readonly max_file_bytes: ElfReadBudgetBounds;
readonly max_entries: ElfReadBudgetBounds;
}
/** Smallest `max_file_bytes`: an ELF64 file header. */
export const MINIMUM_ELF_READ_FILE_BYTES = 64;
/** `max_file_bytes` when omitted. */
export const DEFAULT_ELF_READ_FILE_BYTES = 64 * 1024 * 1024;
/**
* The per-call control that stopped an ELF reader, named by its contract
* field; each adapter names the option that sets it. The schema owns the same
* bounds, so the reported range is the one the next call accepts.
*/
export const elfReadBudgetLimit = (
budgets: ElfReadBudgets,
parameter: keyof ElfReadBudgets,
effectiveValue: number,
): AnalysisParameterLimit => ({
control_kind: "parameter",
parameter,
effective_value: effectiveValue,
unit: parameter === "max_file_bytes" ? "bytes" : "count",
...budgets[parameter],
applies_at: "next_call",
});
+9 -2
View File
@@ -78,6 +78,8 @@ export type Il2cppBinaryReadOptions = Pick<
> & {
/** Also link genericMethodTable rows; unrequested paths read no generic table. */
readonly genericInstances?: boolean;
/** Caller's ELF pointer index allowance (`max_native_index_bytes`). */
readonly maxNativeIndexBytes?: number;
};
const assertGenericLinkLayout = (
@@ -101,7 +103,12 @@ export function* linkIl2cppBinarySteps(
): Generator<void, Il2cppBinaryLink> {
assertGenericLinkLayout(metadata, options);
yield;
return yield* linkImageSteps(openImageSteps(bytes), metadata, facts, options);
return yield* linkImageSteps(
openImageSteps(bytes, undefined, options.maxNativeIndexBytes),
metadata,
facts,
options,
);
}
export const linkIl2cppBinaryCooperative = async (
@@ -115,7 +122,7 @@ export const linkIl2cppBinaryCooperative = async (
await pause();
const container = await readIl2cppBinaryContainerCooperative(bytes, pause);
const steps = linkImageSteps(
openImageSteps(bytes, container),
openImageSteps(bytes, container, options.maxNativeIndexBytes),
metadata,
facts,
options,
+8 -2
View File
@@ -1,6 +1,9 @@
import { ParseFailureError } from "../domain/parseFailure.js";
/** Existing selected-binary allowance also bounds its retained pointer workspace. */
/**
* Selected-binary file allowance. The ELF pointer index has its own per-call
* control, `max_native_index_bytes`.
*/
export const IL2CPP_BINARY_BYTES = 1024 * 1024 * 1024;
export const IL2CPP_BINARY_FAILURE_REASONS = {
@@ -79,12 +82,15 @@ export class Il2cppBinaryFormatFailure extends ParseFailureError<
message: string,
maximum: number,
unit: NativeBudgetUnit,
limitName?: string,
);
constructor(
readonly reason: Il2cppBinaryFailureReason,
message: string,
maximum?: number,
unit?: NativeBudgetUnit,
/** The exceeded budget's name; defaults to the reason for a fixed budget. */
limitName: string = reason,
) {
const detail = `${reason}: ${message}`;
super(
@@ -93,7 +99,7 @@ export class Il2cppBinaryFormatFailure extends ParseFailureError<
kind: "limit",
format: IL2CPP_BINARY_FORMAT,
detail,
limit: { name: reason, maximum },
limit: { name: limitName, maximum },
}
: isUnsupported(reason as Il2cppBinaryFormatReason)
? {
+9 -6
View File
@@ -34,10 +34,8 @@ import {
ElfPointerRelocationFailure,
type ElfVirtualPointerWrites,
} from "../domain/native/elfPointerRelocations.js";
import {
Il2cppBinaryFormatFailure,
IL2CPP_BINARY_BYTES,
} from "./Il2cppBinaryFormat.js";
import { DEFAULT_IL2CPP_NATIVE_INDEX_BYTES } from "../domain/il2cpp/il2cppMetadata.js";
import { Il2cppBinaryFormatFailure } from "./Il2cppBinaryFormat.js";
/** Selection failures name the binary's architecture input and IL2CPP's public spellings. */
const IL2CPP_SLICE_SELECTION_INPUT: SliceSelectionInput = {
@@ -126,10 +124,14 @@ export const readIl2cppBinaryContainerCooperative = async (
}
};
/** Open one thin image; a universal Mach-O slice is selected before this. */
/**
* Open one thin image; a universal Mach-O slice is selected before this.
* `maximumIndexBytes` is the caller's ELF pointer index allowance.
*/
export function* openImageSteps(
image: Buffer,
preparedContainer?: BinaryContainer,
maximumIndexBytes: number = DEFAULT_IL2CPP_NATIVE_INDEX_BYTES,
): Generator<void, NativeImage> {
const container = preparedContainer ?? readContainer(image);
if (container.bits !== 64 || container.byte_order !== "little")
@@ -150,7 +152,7 @@ export function* openImageSteps(
mappings: container.mappings,
zeroFills: container.zero_fills,
},
IL2CPP_BINARY_BYTES,
maximumIndexBytes,
{ symbolResolution: "image-definitions" },
);
} catch (cause) {
@@ -161,6 +163,7 @@ export function* openImageSteps(
cause.message,
cause.failure.limit.maximum,
cause.unit,
cause.failure.limit.name,
);
if (cause.reason !== "native-index-capacity")
throw new Il2cppBinaryFormatFailure(cause.reason, cause.message);
+17
View File
@@ -50,9 +50,11 @@ import {
} from "../domain/analysisErrorCore.js";
import {
il2cppMetadataSchema,
il2cppNativeIndexLimit,
type Il2cppMetadata,
type Il2cppMetadataProviderInput,
} from "../domain/il2cpp/il2cppMetadata.js";
import { ELF_VIRTUAL_POINTER_INDEX_LIMIT } from "../domain/native/elfPointerRelocations.js";
import { fixedAllowanceOptions } from "../domain/fixedAllowanceRemediation.js";
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
@@ -120,6 +122,18 @@ const failureForPrimary = (
const { cause, origin } = facts;
if (origin === "owned-or-classified" && cause instanceof AnalysisError)
return cause;
if (
cause instanceof Il2cppBinaryFormatFailure &&
isParseLimit(cause, IL2CPP_BINARY_FORMAT) &&
cause.failure.limit.name === ELF_VIRTUAL_POINTER_INDEX_LIMIT
) {
const selected = cause.failure.limit.maximum;
return parseLimitConstraint(OPERATION, "memory", cause, {
retryable: false,
limit: il2cppNativeIndexLimit(selected),
remediationAction: `The ELF pointer index allowance is max_native_index_bytes = ${String(selected)} bytes. Pass a larger max_native_index_bytes (up to ${String(Number.MAX_SAFE_INTEGER)}) on the next ${OPERATION} call with the same binary_path; no restart is required. Host memory and the binary file allowance are independent. Repeating the unchanged request fails the same way.`,
});
}
if (
cause instanceof Il2cppBinaryFormatFailure &&
isParseLimit(cause, IL2CPP_BINARY_FORMAT)
@@ -598,6 +612,9 @@ export class Il2cppMetadataProvider implements Il2cppMetadataPort {
{
...admission,
genericInstances: input.generic_instances === true,
...(input.max_native_index_bytes === undefined
? {}
: { maxNativeIndexBytes: input.max_native_index_bytes }),
},
async () => {
await this.yieldControl();
+17
View File
@@ -23,6 +23,7 @@ import { fixedAllowanceOptions } from "../../domain/fixedAllowanceRemediation.js
import {
ELF_DEBUG_LINK_CANDIDATE_INCOMPLETE_LIMITATION,
ELF_DEBUG_LINK_CANDIDATE_COMPARISON_INCOMPLETE_LIMITATION,
ELF_DEBUG_LINK_READ_BUDGETS,
MAX_ELF_DEBUG_CANDIDATE_BYTES,
MAX_INSPECT_ELF_DEBUG_LINK_ENTRIES,
MAX_INSPECT_ELF_DEBUG_LINK_FILE_BYTES,
@@ -46,6 +47,7 @@ import {
} from "./ElfDebugLink.js";
import { ELF_NOTE_TEXT_ALLOWANCE } from "./ElfNoteParser.js";
import { elfSectionNameBudget } from "../../domain/native/elfSectionNameTable.js";
import { elfReadBudgetLimit } from "../../domain/native/elfReadBudgets.js";
const OPERATION = "inspect_elf_debug_link";
const HEADER_PREFIX_BYTES = 4096;
@@ -353,6 +355,11 @@ const elfDebugLinkFailure = (
if (isParseLimit(failure, "elf") && sectionNameBudget !== undefined)
return parseLimitConstraint(OPERATION, "memory", failure, {
retryable: false,
limit: elfReadBudgetLimit(
ELF_DEBUG_LINK_READ_BUDGETS,
"max_file_bytes",
input.max_file_bytes,
),
remediationAction: sectionNameBudgetRemediation(
sectionNameBudget.required,
field,
@@ -378,6 +385,11 @@ const elfDebugLinkFailure = (
entryBudget
? {
retryable: false,
limit: elfReadBudgetLimit(
ELF_DEBUG_LINK_READ_BUDGETS,
"max_entries",
input.max_entries,
),
remediationAction: inputBudgetRemediation(
"capacity",
input,
@@ -419,6 +431,11 @@ const elfDebugLinkFailure = (
)
: {
retryable: false,
limit: elfReadBudgetLimit(
ELF_DEBUG_LINK_READ_BUDGETS,
"max_file_bytes",
input.max_file_bytes,
),
remediationAction: inputBudgetRemediation(
"file-size",
input,
+17
View File
@@ -21,11 +21,13 @@ import {
} from "../../domain/compression/zstandardFrameAllowance.js";
import { fixedAllowanceOptions } from "../../domain/fixedAllowanceRemediation.js";
import {
ELF_NOTES_READ_BUDGETS,
MAX_INSPECT_ELF_NOTE_ENTRIES,
MAX_INSPECT_ELF_NOTE_FILE_BYTES,
type ElfNotes,
type InspectElfNotesInput,
} from "../../domain/native/elfNotes.js";
import { elfReadBudgetLimit } from "../../domain/native/elfReadBudgets.js";
import { err, ok } from "../../domain/result.js";
import { ELF_NOTES_PROVIDER } from "../../domain/investigationProviders.js";
import { elfSectionNameBudget } from "../../domain/native/elfSectionNameTable.js";
@@ -138,6 +140,11 @@ const elfNotesFailure = (
if (isParseLimit(failure, "elf") && sectionNameBudget !== undefined)
return parseLimitConstraint(OPERATION, "memory", failure, {
retryable: false,
limit: elfReadBudgetLimit(
ELF_NOTES_READ_BUDGETS,
"max_file_bytes",
input.max_file_bytes,
),
remediationAction: sectionNameBudgetRemediation(
sectionNameBudget.required,
),
@@ -151,6 +158,11 @@ const elfNotesFailure = (
entryBudget
? {
retryable: false,
limit: elfReadBudgetLimit(
ELF_NOTES_READ_BUDGETS,
"max_entries",
input.max_entries,
),
remediationAction: inputBudgetRemediation("capacity", input),
}
: fixedAllowanceOptions(ELF_NOTE_TEXT_ALLOWANCE, "parser", {
@@ -173,6 +185,11 @@ const elfNotesFailure = (
),
{
retryable: false,
limit: elfReadBudgetLimit(
ELF_NOTES_READ_BUDGETS,
"max_file_bytes",
input.max_file_bytes,
),
remediationAction: inputBudgetRemediation("file-size", input),
},
),