refactor: finish lint cleanup
This commit is contained in:
@@ -364,6 +364,13 @@ const mapResources = (
|
||||
}
|
||||
};
|
||||
|
||||
const inventoryPagesComplete = (
|
||||
inventory: ReturnType<typeof readManagedMetadataInventory>,
|
||||
): boolean =>
|
||||
inventory.references.complete &&
|
||||
inventory.resources.complete &&
|
||||
inventory.attributes.complete;
|
||||
|
||||
/** Inspect PE/CLI identity directly from bounded bytes without CLR loading. */
|
||||
export const inspectManagedArtifactBytes = (
|
||||
bytes: Buffer,
|
||||
@@ -405,7 +412,13 @@ export const inspectManagedArtifactBytes = (
|
||||
} catch (cause: unknown) {
|
||||
if (!(cause instanceof ManagedReaderFailure)) throw cause;
|
||||
return managedArtifactInspectionSchema.parse(
|
||||
partialMetadataResult({ target, bytes, layout, limits, issue: cause.issue }),
|
||||
partialMetadataResult({
|
||||
target,
|
||||
bytes,
|
||||
layout,
|
||||
limits,
|
||||
issue: cause.issue,
|
||||
}),
|
||||
);
|
||||
}
|
||||
const resourceIssues: ManagedParseIssue[] = [];
|
||||
@@ -417,10 +430,7 @@ export const inspectManagedArtifactBytes = (
|
||||
resourceDirectory,
|
||||
);
|
||||
const issues = [...resourceIssues, ...inventory.issues];
|
||||
const pagesComplete =
|
||||
inventory.references.complete &&
|
||||
inventory.resources.complete &&
|
||||
inventory.attributes.complete;
|
||||
const pagesComplete = inventoryPagesComplete(inventory);
|
||||
const limitations = [
|
||||
...(pagesComplete
|
||||
? []
|
||||
|
||||
@@ -302,7 +302,7 @@ export const parseTypes = (
|
||||
return items;
|
||||
};
|
||||
|
||||
export const readCompressed = (
|
||||
const readCompressed = (
|
||||
bytes: Buffer,
|
||||
offset: number,
|
||||
): { readonly value: number; readonly next: number } => {
|
||||
|
||||
@@ -238,7 +238,10 @@ const readCoffHeader = (bytes: Buffer): CoffHeader => {
|
||||
return { coff, machine, sectionCount, optionalSize, characteristics };
|
||||
};
|
||||
|
||||
const readOptionalHeader = (bytes: Buffer, coff: CoffHeader): OptionalHeader => {
|
||||
const readOptionalHeader = (
|
||||
bytes: Buffer,
|
||||
coff: CoffHeader,
|
||||
): OptionalHeader => {
|
||||
const optionalOffset = coff.coff + 20;
|
||||
requireRange(bytes, optionalOffset, coff.optionalSize, "pe.optional-header");
|
||||
if (coff.optionalSize < 96)
|
||||
@@ -272,13 +275,12 @@ const readSections = (
|
||||
coff: CoffHeader,
|
||||
optional: OptionalHeader,
|
||||
): readonly PeSection[] => {
|
||||
const sectionOffset = add(optional.optionalOffset, coff.optionalSize, "pe.sections");
|
||||
requireRange(
|
||||
bytes,
|
||||
sectionOffset,
|
||||
coff.sectionCount * 40,
|
||||
const sectionOffset = add(
|
||||
optional.optionalOffset,
|
||||
coff.optionalSize,
|
||||
"pe.sections",
|
||||
);
|
||||
requireRange(bytes, sectionOffset, coff.sectionCount * 40, "pe.sections");
|
||||
const sections: PeSection[] = [];
|
||||
for (let index = 0; index < coff.sectionCount; index += 1) {
|
||||
const offset = sectionOffset + index * 40;
|
||||
|
||||
Reference in New Issue
Block a user