diff --git a/src/labview/LabviewRsrc.ts b/src/labview/LabviewRsrc.ts index 36ba5523efa..5e3bf71ef98 100644 --- a/src/labview/LabviewRsrc.ts +++ b/src/labview/LabviewRsrc.ts @@ -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;