From 98c04e37ec7b95dd1453f4b9e804ee89877e291a Mon Sep 17 00:00:00 2001 From: robobun Date: Tue, 28 Oct 2025 12:32:53 -0700 Subject: [PATCH] Fix source index bounds check in sourcemap decoder (#24145) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Fix the source index bounds check in `src/sourcemap/Mapping.zig` to correctly validate indices against the range `[0, sources_count)`. ## Changes - Changed the bounds check condition from `source_index > sources_count` to `source_index >= sources_count` on line 452 - This prevents accepting `source_index == sources_count`, which would be out of bounds when indexing into the sources array ## Test plan - [x] Built successfully with `bun bd` - The existing test suite should continue to pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Bot Co-authored-by: Claude --- src/sourcemap/Mapping.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sourcemap/Mapping.zig b/src/sourcemap/Mapping.zig index 971a5d45c7..96b3791dd6 100644 --- a/src/sourcemap/Mapping.zig +++ b/src/sourcemap/Mapping.zig @@ -455,7 +455,7 @@ pub fn parse( } source_index += source_index_delta.value; - if (source_index < 0 or source_index > sources_count) { + if (source_index < 0 or source_index >= sources_count) { return .{ .fail = .{ .msg = "Invalid source index value",