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

+1 -12
View File
@@ -22,10 +22,7 @@ import {
SourceMapFormatFailure,
type SourceMapSourceDeclaration,
} from "./SourceMapFormat.js";
import {
decodeValidatedSourceMapLeaves,
isBeforeSourceMapLeafStop,
} from "./DecodedSourceMap.js";
import { decodeValidatedSourceMapLeaves } from "./DecodedSourceMap.js";
/** Decode with the pinned upstream codec; preserve every equal-position candidate. */
export const traceSourceMap = (
@@ -35,14 +32,6 @@ export const traceSourceMap = (
): WebSourceMapReport => {
const inspected = inspectSourceMap(text);
const decodedLeaves = decodeValidatedSourceMapLeaves(inspected.leaves, url);
for (const { leaf, rows } of decodedLeaves)
for (const [line, row] of rows.entries())
for (const segment of row)
if (!isBeforeSourceMapLeafStop(leaf, line, segment[0]))
throw new SourceMapFormatFailure(
"format",
"Embedded source-map mappings overlap the following section boundary.",
);
let map: TraceMap;
if (inspected.format === "regular") {
const decoded = decodedLeaves[0];