mirror of
https://github.com/morluto/rea.git
synced 2026-11-30 02:17:09 +00:00
refactor(providers): pass stable file handles directly to parsers (#14508)
This commit is contained in:
1 parent
4f839e6a8f
commit
3124e6b7e2
12 files changed
+14
-64
No files matched your search
@@ -309,11 +309,7 @@ export class GoBinaryProvider implements GoBinaryPort {
|
||||
const selected = await requireSelectedNativeImageFromReader(
|
||||
OPERATION,
|
||||
input.path,
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
input.architecture,
|
||||
);
|
||||
const imageOptions = {
|
||||
|
||||
@@ -90,11 +90,7 @@ export class DwarfUnitsProvider {
|
||||
const selected = await requireSelectedNativeImageFromReader(
|
||||
OPERATION,
|
||||
input.path,
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
input.architecture,
|
||||
);
|
||||
const located = await locateDwarfSectionsFromHandle(
|
||||
|
||||
@@ -95,11 +95,7 @@ export class ElfDebugLinkProvider implements ElfDebugLinkPort {
|
||||
},
|
||||
(handle) =>
|
||||
parseElfDebugLinkFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
|
||||
@@ -79,11 +79,7 @@ export class ElfDependenciesProvider {
|
||||
async (handle) => {
|
||||
assertArtifactReadActive(options?.signal);
|
||||
const parsed = await parseElfDependenciesFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
|
||||
@@ -75,11 +75,7 @@ export class ElfNotesProvider implements ElfNotesPort {
|
||||
},
|
||||
(handle) =>
|
||||
parseElfNotesFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
|
||||
@@ -76,11 +76,7 @@ export class ElfUnwindRangesProvider implements ElfUnwindRangesPort {
|
||||
},
|
||||
(handle) =>
|
||||
parseElfUnwindRangesFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{ path: input.path, sha256: handle.sha256, bytes: handle.size },
|
||||
input,
|
||||
signal,
|
||||
|
||||
@@ -69,11 +69,7 @@ export class KernelBuildConfigProvider implements KernelBuildConfigPort {
|
||||
},
|
||||
(handle) =>
|
||||
parseKernelBuildConfigFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
|
||||
@@ -66,11 +66,7 @@ export class KernelModuleProvider implements KernelModulePort {
|
||||
},
|
||||
(handle) =>
|
||||
parseKernelModuleFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
|
||||
@@ -78,11 +78,7 @@ export class NativeExportsProvider implements NativeExportsPort {
|
||||
},
|
||||
(handle) =>
|
||||
parseNativeExportsFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{ path: input.path, sha256: handle.sha256, bytes: handle.size },
|
||||
() => yieldArtifactRead(signal),
|
||||
),
|
||||
|
||||
@@ -76,12 +76,6 @@ export class BinaryHardeningProvider implements BinaryHardeningPort {
|
||||
},
|
||||
async (handle) => {
|
||||
assertArtifactReadActive(options?.signal);
|
||||
const source = {
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset: number, length: number) =>
|
||||
handle.readRange(offset, length),
|
||||
};
|
||||
const artifact = {
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
@@ -92,7 +86,7 @@ export class BinaryHardeningProvider implements BinaryHardeningPort {
|
||||
artifact,
|
||||
format: "elf" as const,
|
||||
images: [
|
||||
await readElfHardeningFromHandle(source, options?.signal),
|
||||
await readElfHardeningFromHandle(handle, options?.signal),
|
||||
],
|
||||
limitations: [...BINARY_HARDENING_LIMITATIONS],
|
||||
};
|
||||
@@ -102,7 +96,7 @@ export class BinaryHardeningProvider implements BinaryHardeningPort {
|
||||
format: "pe" as const,
|
||||
images: [
|
||||
await readPeHardeningFromHandle(
|
||||
source,
|
||||
handle,
|
||||
artifact,
|
||||
options?.signal,
|
||||
),
|
||||
@@ -113,7 +107,7 @@ export class BinaryHardeningProvider implements BinaryHardeningPort {
|
||||
artifact,
|
||||
format: "mach-o" as const,
|
||||
images: await readMachoHardeningFromHandle(
|
||||
source,
|
||||
handle,
|
||||
options?.signal,
|
||||
),
|
||||
limitations: [...BINARY_HARDENING_LIMITATIONS],
|
||||
|
||||
@@ -72,11 +72,7 @@ export class PeImportsProvider implements PeImportsPort {
|
||||
async (handle) => {
|
||||
assertArtifactReadActive(options?.signal);
|
||||
const parsed = await parsePeImportsFromHandle(
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
{
|
||||
path: input.path,
|
||||
sha256: handle.sha256,
|
||||
|
||||
@@ -117,11 +117,7 @@ export class RustBinaryProvider implements RustBinaryPort {
|
||||
const selected = await requireSelectedNativeImageFromReader(
|
||||
OPERATION,
|
||||
input.path,
|
||||
{
|
||||
size: handle.size,
|
||||
prefix: handle.prefix,
|
||||
readRange: (offset, length) => handle.readRange(offset, length),
|
||||
},
|
||||
handle,
|
||||
input.architecture,
|
||||
);
|
||||
const image = inFile(
|
||||
|
||||
Reference in new issue
Block a user