refactor(labview): reuse the checked section table extent (#17171)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-06 01:45:01 +08:00
1 parent 18c8664072
commit 03004ec6ba
1 file changed
+3 -11
+3 -11
View File
@@ -388,7 +388,8 @@ export const parseLabviewRsrc = (
"RSRC section-start table overlaps the block headers",
{ offset: headerAt + 8, field: identifier },
);
if (!inside(startsAt, sectionCount * SECTION_START_BYTES, listEnd))
const tableBytes = sectionCount * SECTION_START_BYTES;
if (!inside(startsAt, tableBytes, listEnd))
throw truncatedInput(FORMAT, "truncated RSRC section starts", {
offset: startsAt,
field: identifier,
@@ -416,17 +417,8 @@ export const parseLabviewRsrc = (
),
{ offset: headerAt + 4, field: identifier },
);
namesBase = Math.max(
namesBase,
startsAt + sectionCount * SECTION_START_BYTES,
);
namesBase = Math.max(namesBase, startsAt + tableBytes);
}
if (namesBase > listEnd)
throw truncatedInput(
FORMAT,
"RSRC section-name list exceeds the declared list",
{ offset: namesBase },
);
for (let blockIndex = 0; blockIndex < blockCount; blockIndex += 1) {
const headerAt = blockHeadersAt + blockIndex * BLOCK_HEADER_BYTES;