Fix crash in Error.captureStackTrace when stackTraceLimit is nullopt#28719
Fix crash in Error.captureStackTrace when stackTraceLimit is nullopt#28719
Conversation
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, push a new commit or reopen this pull request to trigger a review.
|
Updated 12:37 PM PT - Mar 31st, 2026
❌ @robobun, your commit 1c2c593 has 7 failures in
🧪 To try this PR locally: bunx bun-pr 28719That installs a local version of the PR into your bun-28719 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughSwitches stack-trace limit retrieval to use a safe fallback ( Changes
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches⚔️ Resolve merge conflicts
Comment |
3c11bc4 to
7d31b80
Compare
Use value_or(DEFAULT_ERROR_STACK_TRACE_LIMIT) instead of value() on the std::optional<unsigned> returned by stackTraceLimit(). When Error.stackTraceLimit is set to a non-number or deleted, the optional becomes nullopt and calling .value() triggers std::bad_optional_access which aborts the process.
7d31b80 to
1c2c593
Compare
Fixes a crash (SIGABRT) in
Error.captureStackTracewhenError.stackTraceLimithas been deleted or set to a non-number value.Root Cause
In
FormatStackTraceForJS.cpp, line 685 calls.value()on thestd::optional<unsigned>returned byglobalObject->stackTraceLimit():When
Error.stackTraceLimitis set to a non-number (e.g. a string, undefined) or deleted,ErrorConstructor::put/ErrorConstructor::deletePropertyin WebKit sets the internal optional tostd::nullopt. Calling.value()on an empty optional throwsstd::bad_optional_access, which terminates the process with SIGABRT.Fix
Use
.value_or(DEFAULT_ERROR_STACK_TRACE_LIMIT)instead of.value(), matching the pattern used in WebKit's ownErrorConstructor.cppand other call sites in Bun.Repro