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

Issue 610645 link

Starred by 3 users

Issue metadata

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



Sign in to add a comment

Heap-buffer-overflow in SkAAClipBlitter::blitMask

Project Member Reported by ClusterFuzz, May 10 2016

Issue description

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

Fuzzer: inferno_twister
Job Type: linux_lsan_chrome_mp
Platform Id: linux

Crash Type: Heap-buffer-overflow READ 4
Crash Address: 0x61a00002b200
Crash State:
  SkAAClipBlitter::blitMask
  DrawOneGlyph::blitMask
  DrawOneGlyph::operator
  
Recommended Security Severity: Medium

Regressed: https://cluster-fuzz.appspot.com/revisions?job=linux_lsan_chrome_mp&range=383194:384397

Minimized Testcase (0.51 Kb): https://cluster-fuzz.appspot.com/download/AMIfv957rb0tM2hPk-8QKIp9ON_AE-SgmKuBU-eulGkoVrofAM_HlPo33o4b9Qo86V6_xPOCC9HmFo1hQ9eMpivQW44sgMGFCO5dnncZZ8wHRcz20zf6-ILS-jyjeNt8MjDThz7jprzAD9z0h3_9v3wJ9UZ3eyo7hA

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
Labels: M-51 Pri-2
Owner: benjamin...@chromium.org
Project Member

Comment 2 by ClusterFuzz, May 10 2016

Status: Assigned (was: Available)
Project Member

Comment 3 by sheriffbot@chromium.org, May 10 2016

Labels: ReleaseBlock-Stable
Project Member

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

Labels: -Pri-2 Pri-1
Owner: benjamin...@google.com
Cc: bungeman@google.com
Cc: bunge...@chromium.org
Cc: reed@google.com
Attaching SKP. Causes assertion:
../../include/core/SkRect.h:269: fatal error: ""left < right && top < bottom""


layer_0.skp
13.7 MB Download

Comment 10 by reed@google.com, May 10 2016

Cc: herb@chromium.org

Comment 11 by reed@google.com, May 10 2016

Owner: fmalita@chromium.org
The textblob contains NaN in one of its (Y) coordinates. This in turn triggers bad bounds calculations.

- detect/fix/abort during textblob construction?
- detect/etc. during each draw?
- other?
Cc: benjamin...@chromium.org
Cc: fmalita@chromium.org
Owner: drott@chromium.org
  letter-spacing: 170141183460469231731687303715884105727mm;

That's apparently large enough to overflow floats and we get degenerate glyph offsets.

Dominik, should the shaper or CSS parser sanitize this?  We could catch it at blob construction time, but it seems it should be handled earlier.
Components: Internals>Skia Blink>Text
A friendly reminder that M51 Stable is launching soon! Your bug is labelled as Stable ReleaseBlock, pls make sure to land the fix and get it merged into the release branch by May 17. All changes MUST be merged into the release branch by 5pm on May 20 to make into the desktop Stable final build cut. Thanks!

Comment 16 by herb@chromium.org, May 13 2016

Cc: herb@google.com

Comment 17 Deleted

Comment 18 by drott@chromium.org, May 16 2016

Cc: timloh@chromium.org
Tim, do you know of more such examples? Where should this be captured, at the parsing stage or later, when assigning it to FontDescription?
M51 Stable is launching very soon! Your bug is labelled as Stable ReleaseBlock, pls make sure to land the fix and get it merged ASAP. All changes MUST be merged into the release branch by 5pm on May 20 to make into the desktop Stable final build cut. Thank you!

Comment 20 by drott@chromium.org, May 17 2016

The high letter-spacing is not the root of the issue here. It seems to be that we're taking the horizontal glyph buffer fast path (fillFastHorizontalGlyphBuffer) for a combination of a Chinese character, an Arabic ligatures, vertical text and non-null letter spacing. I've reduced it to:

&#x75ba;&#xfcb7;
<style>* { writing-mode: vertical-lr; letter-spacing: 1;}

Comment 21 by drott@chromium.org, May 17 2016

Actually, just 

&#xfcb7;
<style>* { writing-mode: vertical-lr; letter-spacing: 1;}

triggers the crash as well.
You're talking about the !glyphData.offset.height() assert, right?  I think that's a separate issue triggered by the same CF test.

I have a fix for it (http://crrev.com/1982313002) but it doesn't help with the numberic overflow in the CF crashes.

Comment 23 by drott@chromium.org, May 18 2016

Great! Thanks a lot for the fix. I'll look into the remaining overflow issue.

Comment 25 by drott@chromium.org, May 18 2016

CL up for fixing overflow issue: https://codereview.chromium.org/1987223002
Project Member

Comment 26 by bugdroid1@chromium.org, May 18 2016

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

commit 6dd652af9ab5089938ce8c24513b4a768d0c5b45
Author: drott <drott@chromium.org>
Date: Wed May 18 12:19:43 2016

Clamp, not cast length value in CSS length conversion

computeLength() in CSSPrimitiveValue was returning only static_cast'ed,
but not clamped values, leading to float overflows in font and Skia code
down the line.

The test result needs to be compared visually as the crash does not trigger
using dumpAsText().

BUG= 610645 
TEST=fast/text/letter-spacing-crash.html

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

[add] https://crrev.com/6dd652af9ab5089938ce8c24513b4a768d0c5b45/third_party/WebKit/LayoutTests/fast/text/letter-spacing-crash-expected.html
[add] https://crrev.com/6dd652af9ab5089938ce8c24513b4a768d0c5b45/third_party/WebKit/LayoutTests/fast/text/letter-spacing-crash.html
[modify] https://crrev.com/6dd652af9ab5089938ce8c24513b4a768d0c5b45/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp

Comment 27 by drott@chromium.org, May 18 2016

Labels: Merge-Request-51
Status: Fixed (was: Assigned)
Project Member

Comment 28 by sheriffbot@chromium.org, May 18 2016

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Before we approve merge to M51, Could you please confirm whether this bug is baked/verified in Canary and safe to merge?

Comment 30 by drott@chromium.org, May 19 2016

Verified that the 51 beta still crashes on Windows with the test case from r394390, and that the Windows 52.2741 Canary, which is at r394609 and includes the CL, fixes the issue.

I consider the CL safe to merge. It's essentially a one line fix that avoids truncation in a double to float conversion.

Comment 31 by tin...@google.com, May 19 2016

Labels: -Merge-Request-51 Merge-Approved-51 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M51 (branch: 2704)
Please merge your change to M51 branch 2704 ASAP as we're getting closer to M51 stable launch.
Project Member

Comment 33 by ClusterFuzz, May 20 2016

ClusterFuzz has detected this issue as fixed in range 394251:394739.

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

Fuzzer: inferno_twister
Job Type: linux_lsan_chrome_mp
Platform Id: linux

Crash Type: Heap-buffer-overflow READ 4
Crash Address: 0x61a00002b200
Crash State:
  SkAAClipBlitter::blitMask
  DrawOneGlyph::blitMask
  DrawOneGlyph::operator
  
Recommended Security Severity: Medium

Regressed: https://cluster-fuzz.appspot.com/revisions?job=linux_lsan_chrome_mp&range=383194:384397
Fixed: https://cluster-fuzz.appspot.com/revisions?job=linux_lsan_chrome_mp&range=394251:394739

Minimized Testcase (0.51 Kb): https://cluster-fuzz.appspot.com/download/AMIfv957rb0tM2hPk-8QKIp9ON_AE-SgmKuBU-eulGkoVrofAM_HlPo33o4b9Qo86V6_xPOCC9HmFo1hQ9eMpivQW44sgMGFCO5dnncZZ8wHRcz20zf6-ILS-jyjeNt8MjDThz7jprzAD9z0h3_9v3wJ9UZ3eyo7hA

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.
Project Member

Comment 34 by bugdroid1@chromium.org, May 20 2016

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

commit f48d7f9108d7718324e9c9e5cd7008a8862dc12c
Author: Dominik Röttsches <drott@chromium.org>
Date: Fri May 20 07:18:40 2016

Clamp, not cast length value in CSS length conversion

computeLength() in CSSPrimitiveValue was returning only static_cast'ed,
but not clamped values, leading to float overflows in font and Skia code
down the line.

The test result needs to be compared visually as the crash does not trigger
using dumpAsText().

BUG= 610645 
TEST=fast/text/letter-spacing-crash.html

Review-Url: https://codereview.chromium.org/1987223002
Cr-Commit-Position: refs/heads/master@{#394390}
(cherry picked from commit 6dd652af9ab5089938ce8c24513b4a768d0c5b45)

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

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

[add] https://crrev.com/f48d7f9108d7718324e9c9e5cd7008a8862dc12c/third_party/WebKit/LayoutTests/fast/text/letter-spacing-crash-expected.html
[add] https://crrev.com/f48d7f9108d7718324e9c9e5cd7008a8862dc12c/third_party/WebKit/LayoutTests/fast/text/letter-spacing-crash.html
[modify] https://crrev.com/f48d7f9108d7718324e9c9e5cd7008a8862dc12c/third_party/WebKit/Source/core/css/CSSPrimitiveValue.cpp

Issue 619370 has been merged into this issue.
Project Member

Comment 36 by sheriffbot@chromium.org, Aug 24 2016

Labels: -Restrict-View-SecurityNotify
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 37 by sheriffbot@chromium.org, Oct 1 2016

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 38 by sheriffbot@chromium.org, Oct 2 2016

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
Labels: allpublic

Sign in to add a comment