CVE-2026-8540
Overview
Changed Functions
| Function | Change | Notes |
|---|---|---|
fortest/mjsunit/maglev/regress-496627235.js |
modified |
Files Changed
src/maglev/maglev-graph-builder.cctest/mjsunit/maglev/regress-496627235.js
Patch
From e6c5b6cb3a656b95eb8849d2c274f92bfd29ef32 Mon Sep 17 00:00:00 2001 From: Toon Verwaest <[email protected]> Date: Fri, 27 Mar 2026 17:20:06 +0100 Subject: [PATCH] [maglev] Restore mergepoint scope info in OsrPrewalk Bug: 496627235 Change-Id: I69bdb19b37e0f56c3094112123fca75dd8d4b01d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7705960 Commit-Queue: Toon Verwaest <[email protected]> Reviewed-by: Leszek Swirski <[email protected]> Auto-Submit: Toon Verwaest <[email protected]> Cr-Commit-Position: refs/heads/main@{#106118} --- diff --git a/src/maglev/maglev-graph-builder.cc b/src/maglev/maglev-graph-builder.cc index 2e874f3..524a78c 100644 --- a/src/maglev/maglev-graph-builder.cc +++ b/src/maglev/maglev-graph-builder.cc @@ -17046,6 +17046,9 @@ auto it = saved_states.find(offset); if (it != saved_states.end()) { SetCurrentScopeInfo(it->second); + } else if (merge_states_[offset] != nullptr && + merge_states_[offset]->has_context_scope_info()) { + SetCurrentScopeInfo(merge_states_[offset]->context_scope_info()); } PrewalkBytecode(); diff --git a/test/mjsunit/maglev/regress-496627235.js b/test/mjsunit/maglev/regress-496627235.js new file mode 100644 index 0000000..9236a7c --- /dev/null +++ b/test/mjsunit/maglev/regress-496627235.js @@ -0,0 +1,24 @@ +// Copyright 2026 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +let x = 100; +function f(osr) { + try { let x; ()=>x; throw "bla" } catch(e) {}; + let y; + for (let i = 0; i < 10; i++) { + if (osr) %OptimizeOsr(); + osr = false; + y = x; + } + return y; +} + +%PrepareFunctionForOptimization(f); +f(false); +f(false); +f(false); +f(false); +assertEquals(100, f(true));
Regression Test / PoC
diff --git a/test/mjsunit/maglev/regress-496627235.js b/test/mjsunit/maglev/regress-496627235.js
new file mode 100644
index 0000000..9236a7c
--- /dev/null
+++ b/test/mjsunit/maglev/regress-496627235.js
@@ -0,0 +1,24 @@
+// Copyright 2026 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+let x = 100;
+function f(osr) {
+ try { let x; ()=>x; throw "bla" } catch(e) {};
+ let y;
+ for (let i = 0; i < 10; i++) {
+ if (osr) %OptimizeOsr();
+ osr = false;
+ y = x;
+ }
+ return y;
+}
+
+%PrepareFunctionForOptimization(f);
+f(false);
+f(false);
+f(false);
+f(false);
+assertEquals(100, f(true));
Original Bug Report
DCHECK failure in Holder<To> v8::internal::TrustedCast(Holder<From>, SourceLocation) [To = v8::int
Detailed Report: https://clusterfuzz.com/testcase?key=5559284939128832
Fuzzer: None Job Type: linux_asan_d8_dbg Platform Id: linux
Crash Type: DCHECK failure Crash Address: Crash State: Holder<To> v8::internal::TrustedCast(Holder<From>, SourceLocation) [To = v8::int _ZN2v88internal6Object16ConvertToNumericINS0_6HandleEQsr3stdE16is_convertible_vI Tv8::internal::Object::MaybeType v8::internal::Object::ToNumeric<v8::internal:
Sanitizer: address (ASAN)
Regressed: https://clusterfuzz.com/revisions?job=linux_asan_d8_dbg&range=105997:105998
Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=5559284939128832
Issue filed automatically.
To reproduce this, please build the target in this report and run it against the reproducer testcase. Please use the GN arguments provided at bottom of this report when building the binary.
If you have trouble reproducing, please also export the environment variables listed under “[Environment]” in the crash stacktrace.
If you have any feedback on reproducing test cases, let us know at https://forms.gle/Yh3qCYFveHj6E5jz5 so we can improve.