New issue
Advanced search Search tips

Issue 873037 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Aug 10
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug



Sign in to add a comment

Undo command attempts to set invalid selection

Project Member Reported by ClusterFuzz, Aug 10

Issue description

Detailed report: https://clusterfuzz.com/testcase?key=6497558709665792

Fuzzer: bj_broddelwerk
Job Type: linux_debug_chrome
Platform Id: linux

Crash Type: CHECK failure
Crash Address: 
Crash State:
  static_cast<unsigned>(offset) <= ToCharacterData(anchor_node_)->length() (32 vs.
  blink::PositionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> >::Positio
  blink::PositionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> >::Editing
  
Sanitizer: address (ASAN)

Regressed: https://clusterfuzz.com/revisions?job=linux_debug_chrome&range=547593:547597

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=6497558709665792

Issue filed automatically.

See https://github.com/google/clusterfuzz-tools for more information.
 
Project Member

Comment 1 by ClusterFuzz, Aug 10

Components: Internals>Core
Labels: Test-Predator-Auto-Components
Automatically applying components based on crash stacktrace and information from OWNERS files.

If this is incorrect, please apply the Test-Predator-Wrong-Components label.
Project Member

Comment 2 by ClusterFuzz, Aug 10

Labels: Test-Predator-Auto-Owner
Owner: yosin@chromium.org
Status: Assigned (was: Untriaged)
Automatically assigning owner based on suspected regression changelist https://chromium.googlesource.com/chromium/src/+/c8a34cf719bcf005b2e29ca6fba37c6a35505b57 (Validate offset parameter of Position constructor with introducing Position::CreateWithoutValidation()).

If this is incorrect, please let us know why and apply the Test-Predator-Wrong-CLs label. If you aren't the correct owner for this issue, please unassign yourself as soon as possible so it can be re-triaged.
Status: Started (was: Assigned)
Summary: Undo command attempts to set invalid selection (was: CHECK failure: static_cast<unsigned>(offset) <= ToCharacterData(anchor_node_)->length() (32 vs.)
In review: http://crrev.com/c/1170458

The root cause is test script change Text node in undo stack then "undo" command attempt to use invalid selection from undo stack.


Minimal reproduce HTML:
<!doctype html>
<div contenteditable><div></div><b id=target>abc</b></div>
<script>
const selection = window.getSelection();
const target = document.getElementById('target');
selection.collapse(target, 0);
selection.extend(target, 1);
document.execCommand('italic');
target.firstChild.firstChild.nodeValue = '';
document.execCommand('undo');
</script>

Project Member

Comment 4 by bugdroid1@chromium.org, Aug 10

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/673dd7ce01807a268ff27f3837cb402fe90a29e6

commit 673dd7ce01807a268ff27f3837cb402fe90a29e6
Author: Yoshifumi Inoue <yosin@chromium.org>
Date: Fri Aug 10 08:30:39 2018

Make CorrectedSelectionAfterCommand() to check Position offset

This patch changes |CorrectedSelectionAfterCommand()| to use |Position::
IsValidFor()| to make it to check |Position| offset and return valid
selection.

Bug:  873037 
Change-Id: I70c7d6f514a39414a4c3245b59969d19beb13f45
Reviewed-on: https://chromium-review.googlesource.com/1170458
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582090}
[modify] https://crrev.com/673dd7ce01807a268ff27f3837cb402fe90a29e6/third_party/blink/renderer/core/editing/commands/editing_commands_utilities.cc
[modify] https://crrev.com/673dd7ce01807a268ff27f3837cb402fe90a29e6/third_party/blink/renderer/core/editing/editor_test.cc

Components: -Internals>Core Blink>Editing>Command
Status: Fixed (was: Started)
Project Member

Comment 6 by ClusterFuzz, Aug 11

ClusterFuzz has detected this issue as fixed in range 582089:582090.

Detailed report: https://clusterfuzz.com/testcase?key=6497558709665792

Fuzzer: bj_broddelwerk
Job Type: linux_debug_chrome
Platform Id: linux

Crash Type: CHECK failure
Crash Address: 
Crash State:
  static_cast<unsigned>(offset) <= ToCharacterData(anchor_node_)->length() (32 vs.
  blink::PositionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> >::Positio
  blink::PositionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> >::Editing
  
Sanitizer: address (ASAN)

Regressed: https://clusterfuzz.com/revisions?job=linux_debug_chrome&range=547593:547597
Fixed: https://clusterfuzz.com/revisions?job=linux_debug_chrome&range=582089:582090

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=6497558709665792

See https://github.com/google/clusterfuzz-tools for more information.

If you suspect that the result above is incorrect, try re-doing that job on the test case report page.
Project Member

Comment 7 by ClusterFuzz, Aug 11

Labels: ClusterFuzz-Verified
Status: Verified (was: Fixed)
ClusterFuzz testcase 6497558709665792 is verified as fixed, so closing issue as verified.

If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.

Sign in to add a comment