New issue
Advanced search Search tips

Issue 768716 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug-Security



Sign in to add a comment

Use-of-uninitialized-value in blink::InlineTextBox::GetSelectionState

Project Member Reported by ClusterFuzz, Sep 26 2017

Issue description

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

Fuzzer: inferno_layout_test_unmodified
Job Type: linux_msan_chrome
Platform Id: linux

Crash Type: Use-of-uninitialized-value
Crash Address: 
Crash State:
  blink::InlineTextBox::GetSelectionState
  blink::InlineTextBoxPainter::Paint
  blink::InlineTextBox::Paint
  
Sanitizer: memory (MSAN)

Recommended Security Severity: Medium

Regressed: https://clusterfuzz.com/revisions?job=linux_msan_chrome&range=496838:496881

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

Issue filed automatically.

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

Comment 1 by sheriffbot@chromium.org, Sep 26 2017

Labels: M-63
Project Member

Comment 2 by sheriffbot@chromium.org, Sep 26 2017

Labels: ReleaseBlock-Stable
This is a serious security regression. If you are not able to fix this quickly, please revert the change that introduced it.

If this doesn't affect a release branch, or has not been properly classified for severity, please update the Security_Impact or Security_Severity labels, and remove the ReleaseBlock label. To disable this altogether, apply ReleaseBlock-NA.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 3 by sheriffbot@chromium.org, Sep 26 2017

Labels: Pri-1
Components: Blink>Layout Blink>Paint
Owner: wangxianzhu@chromium.org
Status: Assigned (was: Untriaged)
Predator Result:

Fix bug of sequential display item matching broken by subsequence by wangxianzhu@chromium.org
Changed files PaintController.cpp, PaintController.h, PaintControllerTest.cpp, with the same CrashedDirectory(third_party/WebKit/Source/core/paint) as InlineFlowBoxPainter.cpp (in frame#3), RootInlineBoxPainter.cpp (in frame#5), InlineTextBoxPainter.cpp (in frame#1)
Changed files PaintController.cpp, PaintController.h, PaintControllerTest.cpp, with the same CrashedComponent(Blink>Paint) as InlineFlowBoxPainter.cpp (in frame#3), RootInlineBoxPainter.cpp (in frame#5), InlineTextBoxPainter.cpp (in frame#1)
Cc: wangxianzhu@chromium.org
Components: -Blink>Paint
Owner: infe...@chromium.org
I'm confused by the report which says that the following code accesses uninitialized value:
  if (start && end) {
           ^^^
Both |start| and |end| are just initialized above the code.

I added fprintf(stderr, ...) statements around the code to see which variable is uninitialized:

    fprintf(stderr, "A %d %d %d\n", start, end, state);
    if (start && end) {
      state = SelectionState::kStartAndEnd;
      fprintf(stderr, "B %d %d %d\n", start, end, state);
    } else if (start) {
      state = SelectionState::kStart;
      fprintf(stderr, "C %d %d %d\n", start, end, state);
    } else {
      fprintf(stderr, "D %d %d %d\n", start, end, state);
      if (end) {
          ^^^it reported use-of-uinitialized-value here

I also tried __msan_print_shadow(this, sizeof(this)) and __msan_print_shadow(&selection, sizeof(selection)). The former printed some uninitialized bits in |this| (InlineTextBox), but the bits are all paddings which is not accessed by any code. The latter printed no uninitialized value.

inferno@ is there anything I can do for this bug?






Owner: vitalyb...@chromium.org
Vitaly, thoughts here on MSAN report ?
Report is at "selection.LayoutSelectionEnd().value() > start_ &&"
It might be initialized with uninitialized value.
Try to run with msan_track_origins=2
Cc: -wangxianzhu@chromium.org vitalyb...@chromium.org
Owner: wangxianzhu@chromium.org
Cc: wangxianzhu@chromium.org
Owner: yoichio@chromium.org
It's a nullopt dereferece: selection.LayoutSelectionEnd() can be nullopt. We should check for nullopt before using its value.

Related CLs:
https://chromium-review.googlesource.com/566268
https://chromium-review.googlesource.com/577986
Status: Started (was: Assigned)
Project Member

Comment 11 by ClusterFuzz, Oct 1 2017

Labels: Test-Predator-AutoComponents
Automatically applying components based on information from OWNERS files. If this seems incorrect, please apply the Test-Predator-Wrong-Components label.
Labels: -Test-Predator-AutoComponents
Project Member

Comment 13 by bugdroid1@chromium.org, Oct 4 2017

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

commit cfb338179e3d6b8da5b16a1ba1570aeb03480b47
Author: Yoichi Osato <yoichio@chromium.org>
Date: Wed Oct 04 05:28:17 2017

Avoid crash in InlineTextBox::GetSelectionState()

FrameSelection::LayoutSelectionStart/End() is typed Optional<int>
 and we should not call it when selection is empty.
However, LayoutObject::SelectionState and FrameSelection
 often fall into inconsistency: SelectionState is kStart but no
 selection.
I'm working to clean SelectionState marking on Layout tree but
this hits Use-of-uninitialized-value issue.
As fix the security issue, this CL sets optional value |0| for selection
 offset.

Introduce LayoutSelection::SelectionStart()/End() to TouchAdjustment:
https://chromium-review.googlesource.com/c/chromium/src/+/566268

Bug:  768716 
Change-Id: Ic634a3904b967258db8e1cd0ca8140a3e94c496d
Reviewed-on: https://chromium-review.googlesource.com/686031
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506311}
[modify] https://crrev.com/cfb338179e3d6b8da5b16a1ba1570aeb03480b47/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Status: Fixed (was: Started)
Project Member

Comment 15 by sheriffbot@chromium.org, Oct 4 2017

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Project Member

Comment 16 by ClusterFuzz, Oct 5 2017

ClusterFuzz has detected this issue as fixed in range 506303:506326.

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

Fuzzer: inferno_layout_test_unmodified
Job Type: linux_msan_chrome
Platform Id: linux

Crash Type: Use-of-uninitialized-value
Crash Address: 
Crash State:
  blink::InlineTextBox::GetSelectionState
  blink::InlineTextBoxPainter::Paint
  blink::InlineTextBox::Paint
  
Sanitizer: memory (MSAN)

Recommended Security Severity: Medium

Regressed: https://clusterfuzz.com/revisions?job=linux_msan_chrome&range=496838:496881
Fixed: https://clusterfuzz.com/revisions?job=linux_msan_chrome&range=506303:506326

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

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 17 by ClusterFuzz, Oct 5 2017

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

If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.
Labels: -ReleaseBlock-Stable
Project Member

Comment 19 by sheriffbot@chromium.org, Jan 10 2018

Labels: -Restrict-View-SecurityNotify allpublic
This bug has been closed for more than 14 weeks. Removing security view restrictions.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 20 by sheriffbot@chromium.org, Mar 27 2018

Labels: -Security_Impact-Head -M-63 M-65 Security_Impact-Stable

Sign in to add a comment