mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
* refactor(domain): move BinaryContainer into src/domain BinaryContainer imports only domain modules and is shared by artifacts, firmware, gpu, go, il2cpp, python, rust and native. Living under src/native made artifacts and firmware import native for its failure types and BinaryReader. Pure move: git mv plus import specifier updates. * refactor(firmware): move the devicetree parser into src/domain/firmware The FIT artifact reader in src/artifacts parses embedded devicetree blobs with the parser that lived under src/firmware, while firmware's providers import src/artifacts: the two units imported each other. The parser and its fixture are pure and now sit beside domain/firmware/devicetree.ts. Pure move: git mv plus import specifier and baseline key updates. * refactor(artifacts): break the artifacts-gpu import cycle (#11335) * refactor(artifacts): move the LZ4 block decoder into src/artifacts Pure move: git mv plus import specifier updates. The next commit removes its GPU-specific budget. * refactor(artifacts): take the LZ4 output budget from the caller decodeLz4Block bounded every decode by the GPU object budget and threw through rejectGpu, so UnityFS decoding in src/artifacts imported src/gpu while gpu imports artifacts. Callers now pass their budget: GPU payloads keep GPU_OBJECT_BYTES; UnityFS passes its 64 MiB block bound, which its size checks already enforce before decoding. Malformed blocks still throw BinaryFormatFailure with the same messages. * test(architecture): drop the artifacts-firmware and artifacts-gpu cycles from the layer baseline * refactor(artifacts): move the PE resource reader into src/artifacts/pe (#11347) refactor(artifacts): move the PE resource layout and parser into src/artifacts/pe The Node SEA and Deno standalone readers in src/artifacts locate PE resources with the layout and parser that lived under src/native/pe, while those modules already read through src/artifacts (ArtifactReaderFailure, assertArtifactReadActive). Pure move: git mv plus import specifier, baseline key and spec path updates.
25 lines
868 B
TypeScript
25 lines
868 B
TypeScript
import { observeElfStringTableEntry } from "../../domain/elfStringTable.js";
|
|
import {
|
|
BinaryFormatFailure,
|
|
binaryStringReadLimit,
|
|
} from "../../domain/binaryContainer.js";
|
|
|
|
/** Read exact string-table bytes; ELF does not prescribe a character encoding. */
|
|
export const readElfStringBytes = (bytes: Buffer, offset: number): Buffer => {
|
|
const observed = observeElfStringTableEntry(bytes, offset, 65536);
|
|
if (observed.state === "outside")
|
|
throw new BinaryFormatFailure(
|
|
"malformed",
|
|
"ELF string offset is outside its string table",
|
|
);
|
|
if (observed.state === "truncated") {
|
|
if (offset + observed.examinedBytes < bytes.length)
|
|
throw binaryStringReadLimit(observed.examinedBytes);
|
|
throw new BinaryFormatFailure(
|
|
"malformed",
|
|
"ELF string is unterminated inside its string table",
|
|
);
|
|
}
|
|
return observed.bytes;
|
|
};
|