Skip to content

Commit

Permalink
Check nullptr before using in FireWinAccessibilityEvent
Browse files Browse the repository at this point in the history
Previous codes can occur crash when calling
GetRole() or GetBoolAttribute() if target is nullptr.
This patch check null pointer before using it
to prevent crash.

BUG=NONE

Change-Id: Ia65c0e0834bebf3be71caa991e65e721f4640e68
Reviewed-on: https://chromium-review.googlesource.com/587513
Reviewed-by: Dominic Mazzoni <[email protected]>
Commit-Queue: Dominic Mazzoni <[email protected]>
Cr-Commit-Position: refs/heads/master@{#489992}
  • Loading branch information
djmixkim authored and Commit Bot committed Jul 27, 2017
1 parent 38f01d4 commit 3d4a5bf
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ BrowserAccessibilityEvent::Result
if (user_is_navigating_away_)
return BrowserAccessibilityEvent::DiscardedBecauseUserNavigatingAway;

if (!target)
return BrowserAccessibilityEvent::FailedBecauseNoFocus;

// Inline text boxes are an internal implementation detail, we don't
// expose them to Windows.
if (target->GetRole() == ui::AX_ROLE_INLINE_TEXT_BOX)
Expand All @@ -186,9 +189,6 @@ BrowserAccessibilityEvent::Result
return BrowserAccessibilityEvent::DiscardedBecauseLiveRegionBusy;
}

if (!target)
return BrowserAccessibilityEvent::FailedBecauseNoFocus;

event->set_target(target);

// It doesn't make sense to fire a REORDER event on a leaf node; that
Expand Down

0 comments on commit 3d4a5bf

Please sign in to comment.