fix(browser): reject overlapping indexed source maps

Fixes #6562
This commit is contained in:
morluto committed 2026-10-23 18:07:46 +08:00
1 parent 553262443a
commit ba7c3dafab
8 files changed
+151 -23

No files matched your search

@@ -5,7 +5,7 @@ import {
} from "./SourceMapFormat.js";
/** Determine whether a leaf-local mapping falls before its enclosing boundary. */
export const isBeforeSourceMapLeafStop = (
const isBeforeSourceMapLeafStop = (
leaf: SourceMapLeaf,
line: number,
column: number,
@@ -40,6 +40,11 @@ export const decodeValidatedSourceMapLeaves = (
const generatedLine = leaf.offset.line + line;
const generatedColumn =
segment[0] + (line === 0 ? leaf.offset.column : 0);
if (!isBeforeSourceMapLeafStop(leaf, line, segment[0]))
throw new SourceMapFormatFailure(
"section-overlap",
"Embedded source-map mappings overlap the following section boundary.",
);
if (
!Number.isSafeInteger(generatedLine) ||
!Number.isSafeInteger(generatedColumn) ||