refactor(native): report bounded string reads that stop at their allowance as decode limits (#11174)

* refactor(native): report bounded string reads that stop at their allowance as decode limits

* fix(verify): count generic and multi-line plain-Error limit classes
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 22:02:20 +08:00
1 parent 011cd93619
commit 6eb0e3dac6
12 files changed
+124 -47

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
import { observeElfStringTableEntry } from "../../domain/elfStringTable.js";
import {
BinaryFormatFailure,
BinaryStringReadLimitFailure,
binaryStringReadLimit,
} from "./BinaryContainer.js";
/** Read exact string-table bytes; ELF does not prescribe a character encoding. */
@@ -14,7 +14,7 @@ export const readElfStringBytes = (bytes: Buffer, offset: number): Buffer => {
);
if (observed.state === "truncated") {
if (offset + observed.examinedBytes < bytes.length)
throw new BinaryStringReadLimitFailure(observed.examinedBytes);
throw binaryStringReadLimit(observed.examinedBytes);
throw new BinaryFormatFailure(
"malformed",
"ELF string is unterminated inside its string table",