Repository navigation
fix(sourcemap): honor the disable flag in the transpiler cache and fix its startup crash - #189
Merged
Merged
Conversation
Validate map blobs before installing their owned pointers, and regenerate legacy mapless entries when maps are enabled. Include the disable flag only in the enabled flag state to preserve default cache hashes. Adapts empty-map validation from oven-sh#42412.
steipete
marked this pull request as ready for review
October 17, 2026 12:25
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a startup crash when
BUN_FEATURE_FLAG_DISABLE_SOURCE_MAPS=1is used with the runtime transpiler cache. Two sequential imports of identical cacheable TypeScript modules reproduce it with a fresh cache: the first writes an empty map, and the second registers the empty buffer as anInternalSourceMap. Stack remapping then dereferences its dangling pointer at0x11; unloading can also read the invalid header.Validate map headers and bounds before registering their owned pointers. Include the disable flag in the cache features hash only when it is on, so flagged cache hits remain mapless and existing default hashes stay valid. Legacy empty-map entries under the default key are rejected and regenerated. The cache format/version and content-based filenames are unchanged; switching the flag replaces an entry through the existing feature-mismatch path.
Adapts empty-map validation and legacy recovery from oven-sh/bun#42412, with thanks to @robobun. That PR is open, and upstream main
017b2439a7a75c82c7a86a294badd8ef2fc30e28still has both gaps. This change also fixes flag consistency while retaining caching with maps disabled.How did you verify your code works?
r12=0x1atmov 0x10(%r12),%rbxinSavedSourceMap::get_with_content, followed by the source-remapping andBun::formatStackTraceframes.--expose-internalsfor its test-only module.rust:check-allpasses all 12 targets with the release build's generated code. Rustfmt and targeted Prettier pass. Independent Codex P2 autoreview is scoped-clean.77c3b57350a14a60ab4cc8921e13200639b98375.