New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 610641 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 1
Type: Bug



Sign in to add a comment

ASSERTION FAILED: i < m_len in blink::TextRun::operator[]

Project Member Reported by ClusterFuzz, May 10 2016

Issue description

Detailed report: https://cluster-fuzz.appspot.com/testcase?key=5567839548735488

Fuzzer: miaubiz_svg_fuzzer
Job Type: linux_asan_chrome_mp
Platform Id: linux

Crash Type: ASSERT
Crash Address: 
Crash State:
  ASSERTION FAILED: i < m_len
  blink::LayoutSVGInlineText::addMetricsFromRun
  blink::LayoutSVGInlineText::updateMetricsList
  
Regressed: https://cluster-fuzz.appspot.com/revisions?job=linux_asan_chrome_mp&range=387276:387299

Minimized Testcase (1.52 Kb): https://cluster-fuzz.appspot.com/download/AMIfv95LjMFkh2WWQ8J4I6mElC461dOmDVcWloT3TFyAuoWv74e9JIJZkZsK0vLvTDIsL4HW2qDLWPxUWLQluvzM-pqAgWWPslPTrnQeQ6v1C7KI7B66IEpGcUYC0jKcIugasFSoT-Z-tws_vokaz9IFnhsecNJ5OA

Filer: mmoroz

See https://dev.chromium.org/Home/chromium-security/bugs/reproducing-clusterfuzz-bugs for more information.
 

Comment 1 by mmoroz@chromium.org, May 10 2016

Cc: mmoroz@chromium.org mbarbe...@chromium.org
Components: Blink>SVG
Labels: Pri-1
Owner: f...@opera.com
Summary: ASSERTION FAILED: i < m_len in blink::TextRun::operator[] (was: ASSERTION FAILED: i < m_len)

Comment 2 by f...@opera.com, May 10 2016

Status: Started (was: Available)

Comment 3 by f...@opera.com, May 10 2016

We're inconsistently using TextRun::length() and TextRun::charactersLength() to check the length of a TextRun - the assert triggered uses the former while code doing the indexing is using the latter to check if it was in bounds. This however  means that there's no out-of-bounds read here, so I don't see any real security impact here.

Comment 4 by mmoroz@chromium.org, May 10 2016

Glad to hear that we cannot trigger actual out-of-bounds access.
mbarbella@, should we remove Security flag in that case?
Just to make sure I understand this properly, the assert should be checking m_charactersLength, and that wouldn't fail? If so, then I agree that this is not a security bug.

Comment 6 by f...@opera.com, May 10 2016

If the ASSERT checked m_charactersLength it would not fail, no. And to add additional context, m_charactersLength is the length of the underlying buffer (m_data.characters{8,16}).
Labels: -Type-Bug-Security -reward-topanel -Restrict-View-SecurityTeam -Security_Severity-Medium -Security_Impact-Head Type-Bug
Thanks for the clarification. Removing the security labels in that case.
Project Member

Comment 8 by bugdroid1@chromium.org, May 11 2016

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

commit 7dabd875312333379d052e609cc9aad621de1754
Author: fs <fs@opera.com>
Date: Wed May 11 08:46:00 2016

Use the right TextRun length when checking for surrogate pairs

The isValidSurrogatePair helper in LayoutSVGInlineText.cpp operates on a
TextRun and an index, and checks if the character at the index is part
of a valid surrogate pair.
To check the trailing character, the next index is checked against the
length of the TextRun (to see if the character exists).
The TextRun used is a "sub run" of the entire text node, which means
that the operator[] implementation expects accesses to be within the sub
run rather than the "full run".
Since this function is always used for runs that are sub runs, it should
use TextRun::length() rather than TextRun::charactersLength() to stay
consistent with the iteration and the code using it.

BUG= 610641 

Review-Url: https://codereview.chromium.org/1961953004
Cr-Commit-Position: refs/heads/master@{#392880}

[add] https://crrev.com/7dabd875312333379d052e609cc9aad621de1754/third_party/WebKit/LayoutTests/svg/text/unpaired-surrogate-with-trailing-char-crash-expected.txt
[add] https://crrev.com/7dabd875312333379d052e609cc9aad621de1754/third_party/WebKit/LayoutTests/svg/text/unpaired-surrogate-with-trailing-char-crash.html
[modify] https://crrev.com/7dabd875312333379d052e609cc9aad621de1754/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp

Comment 9 by f...@opera.com, May 11 2016

Status: Fixed (was: Started)
Project Member

Comment 10 by ClusterFuzz, May 11 2016

ClusterFuzz has detected this issue as fixed in range 392865:392881.

Detailed report: https://cluster-fuzz.appspot.com/testcase?key=5567839548735488

Fuzzer: miaubiz_svg_fuzzer
Job Type: linux_asan_chrome_mp
Platform Id: linux

Crash Type: ASSERT
Crash Address: 
Crash State:
  ASSERTION FAILED: i < m_len
  blink::LayoutSVGInlineText::addMetricsFromRun
  blink::LayoutSVGInlineText::updateMetricsList
  
Regressed: https://cluster-fuzz.appspot.com/revisions?job=linux_asan_chrome_mp&range=387276:387299
Fixed: https://cluster-fuzz.appspot.com/revisions?job=linux_asan_chrome_mp&range=392865:392881

Minimized Testcase (1.52 Kb): https://cluster-fuzz.appspot.com/download/AMIfv95LjMFkh2WWQ8J4I6mElC461dOmDVcWloT3TFyAuoWv74e9JIJZkZsK0vLvTDIsL4HW2qDLWPxUWLQluvzM-pqAgWWPslPTrnQeQ6v1C7KI7B66IEpGcUYC0jKcIugasFSoT-Z-tws_vokaz9IFnhsecNJ5OA

See https://dev.chromium.org/Home/chromium-security/bugs/reproducing-clusterfuzz-bugs for more information.

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

Comment 11 by f...@opera.com, May 23 2016

Labels: Merge-Request-51

Comment 12 by tin...@google.com, May 23 2016

Labels: -Merge-Request-51 Merge-Review-51 Hotlist-Merge-Review
[Automated comment] Less than 2 weeks to go before stable on M51, manual review required.

Comment 13 by f...@opera.com, May 23 2016

Reason for merge request:  issue 613915 
Before we approve merge to M51, Could you please confirm whether this change is baked/verified in Canary and safe to merge?

Comment 15 by f...@opera.com, May 23 2016

It landed ~12 days ago, and ClusterFuzz verified it (see comment #10.) 
Cc: sshruthi@chromium.org
Labels: -Merge-Review-51 Merge-Approved-51
Approving merge to M51 branch 2704 based on comment #15. Please merge ASAP if possible before 5:00 PM PST today or latest by tomorrow noon, 12:00 PM PST.
Project Member

Comment 17 by bugdroid1@chromium.org, May 24 2016

Labels: -merge-approved-51 merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/80b28a30853ef60bf7c8c4c2c2b47e08569252e3

commit 80b28a30853ef60bf7c8c4c2c2b47e08569252e3
Author: Fredrik Söderquist <fs@opera.com>
Date: Tue May 24 10:35:08 2016

Use the right TextRun length when checking for surrogate pairs

The isValidSurrogatePair helper in LayoutSVGInlineText.cpp operates on a
TextRun and an index, and checks if the character at the index is part
of a valid surrogate pair.
To check the trailing character, the next index is checked against the
length of the TextRun (to see if the character exists).
The TextRun used is a "sub run" of the entire text node, which means
that the operator[] implementation expects accesses to be within the sub
run rather than the "full run".
Since this function is always used for runs that are sub runs, it should
use TextRun::length() rather than TextRun::charactersLength() to stay
consistent with the iteration and the code using it.

BUG= 610641 

Review-Url: https://codereview.chromium.org/1961953004
Cr-Commit-Position: refs/heads/master@{#392880}
(cherry picked from commit 7dabd875312333379d052e609cc9aad621de1754)

Review URL: https://codereview.chromium.org/2005023005 .

Cr-Commit-Position: refs/branch-heads/2704@{#650}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[add] https://crrev.com/80b28a30853ef60bf7c8c4c2c2b47e08569252e3/third_party/WebKit/LayoutTests/svg/text/unpaired-surrogate-with-trailing-char-crash-expected.txt
[add] https://crrev.com/80b28a30853ef60bf7c8c4c2c2b47e08569252e3/third_party/WebKit/LayoutTests/svg/text/unpaired-surrogate-with-trailing-char-crash.html
[modify] https://crrev.com/80b28a30853ef60bf7c8c4c2c2b47e08569252e3/third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp

Cc: -sshruthi@chromium.org

Sign in to add a comment