Commit Graph
3 Commits
Author SHA1 Message Date
Nicolas Bohn 12aad97757 Keep the sources of a source map refused for bad mappings or section offsets (R3.12) (#1717)
A map with malformed mappings or section offsets was reported unreadable, although its sources list is usually whole, and the list is all an application graph keeps. A new sourcemap::parse_sources reads the sources, content, names and ignore list without decoding mappings or checking section offsets; the application graph re-reads a map parse refuses for those reasons this way, lists its sources with a source_map_mappings_unreadable limitation, and compares them as usual. A map whose decodable mappings name a source past the end of its list, or with a malformed section, is still unreadable.
2026-11-12 09:26:47 +07:00
Nicolas Bohn ab79ec87a4 Count source-map sections, check skipped values and keep refused maps' sources uncertain (R3.12) (#1705)
Follow-up to #1703. A sections array of non-objects could cost several times the old parser's memory, skipped values weren't checked as a full read checks them so some broken maps read as valid, entries a repeated key replaces still used the budget, and the analyzer read a map refused at a limit as one with no sources. Index-map sections now count against the entry budget and non-map sections stay small, skipped values get the same string, number and nesting checks, a replaced list is freed and gives its entries back, the default limit is 4,000,000 so a million sources with content fit, and a map refused at any of the parser's limits leaves its sources uncertain with a limitation, while a malformed map is read as before.
2026-11-12 02:43:59 +07:00
Nicolas Bohn ba83da2bc5 Refuse source maps with more entries than the parser keeps (R3.12) (#1703)
The source-map parser read the whole JSON into a value and then copied every sources, sourcesContent and names entry, so a 64 MiB map of empty strings built about 21 million strings twice before anything was checked. It now reads only the fields it uses, straight from the JSON, and counts every sources, sourcesContent, names and ignore-list entry against one limit (2,000,000 by default) shared across sections; a map with more is refused with TooManyEntries as soon as the limit is passed, without reading the rest.
2026-11-12 02:17:19 +07:00