Skip to content

Commit e9fe457

Browse files
GeorgNeismibrunin
authored andcommitted
[Backport] CVE-2021-30598: Type Confusion in V8
Manual cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/3084363: Merged: [compiler] Harden JSCallReducer::ReduceArrayIteratorPrototypeNext Revision: 65b20a0e65e1078f5dd230a5203e231bec790ab4 BUG=chromium:1234764 NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true R=vahl@chromium.org Change-Id: I45faf253695011092de144c8e29bafac5337adec Reviewed-by: Lutz Vahl <vahl@chromium.org> Commit-Queue: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/branch-heads/9.2@{#53} Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
1 parent d07208f commit e9fe457

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

chromium/v8/src/compiler/js-call-reducer.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5826,11 +5826,12 @@ Reduction JSCallReducer::ReduceArrayIteratorPrototypeNext(Node* node) {
58265826
Node* etrue = effect;
58275827
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
58285828
{
5829-
// We know that the {index} is range of the {length} now.
5829+
// This extra check exists to refine the type of {index} but also to break
5830+
// an exploitation technique that abuses typer mismatches.
58305831
index = etrue = graph()->NewNode(
5831-
common()->TypeGuard(
5832-
Type::Range(0.0, length_access.type.Max() - 1.0, graph()->zone())),
5833-
index, etrue, if_true);
5832+
simplified()->CheckBounds(p.feedback(),
5833+
CheckBoundsFlag::kAbortOnOutOfBounds),
5834+
index, length, etrue, if_true);
58345835

58355836
done_true = jsgraph()->FalseConstant();
58365837
if (iteration_kind == IterationKind::kKeys) {

0 commit comments

Comments
 (0)