Commit 813c55e8 authored by Kurt Catti-Schmidt (SCHMIDT)'s avatar Kurt Catti-Schmidt (SCHMIDT) Committed by Commit Bot

More infinite loop prevention in AXPosition::AsValidDOMPosition

This is a speculative fix, as I haven't been able to reproduce this
overflow. There also is not a unit test, because I haven't been able
to reproduce this overflow by tweaking the unit test from
https://chromium-review.googlesource.com/c/chromium/src/+/2426490

However, this is still causing crashes, even after the CL 2426490 has
gone in. And all of the overflows that I've seen after that CL
loop forever in the kMoveRight scenario, so I am confident that this
change will provide the complete mitigation.

Bug: 1124394
Change-Id: Ife9293f2fa26a34c17d1aace03b38b3592f387d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464003Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Kurt Catti-Schmidt <kschmi@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#816199}
parent f742d672
......@@ -763,15 +763,15 @@ const AXPosition AXPosition::AsValidDOMPosition(
(child &&
(!child->GetNode() || child->GetNode()->IsMarkerPseudoElement() ||
child->IsMockObject() || child->IsVirtualObject()))) {
switch (adjustment_behavior) {
case AXPositionAdjustmentBehavior::kMoveRight:
return CreateNextPosition().AsValidDOMPosition(adjustment_behavior);
case AXPositionAdjustmentBehavior::kMoveLeft:
const AXPosition result = CreatePreviousPosition();
if (result && result != *this)
return result.AsValidDOMPosition(adjustment_behavior);
return {};
}
AXPosition result;
if (adjustment_behavior == AXPositionAdjustmentBehavior::kMoveRight)
result = CreateNextPosition();
else
result = CreatePreviousPosition();
if (result && result != *this)
return result.AsValidDOMPosition(adjustment_behavior);
return {};
}
// At this point, if a DOM node is associated with our container, then the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment