Skip to content

Commit

Permalink
CrOS: Speculative crash fix for icon standardizer by limiting scale size
Browse files Browse the repository at this point in the history
This is a speculative crash fix for the call to drawBitmap() in the icon
standardizer. |Scale| is passed in as a multiplying parameter. Instead,
limit its size. This will also save calculation time for the case when
the existing icon is too small to be considered circular.

Bug: 1162155
Change-Id: I466755344551e2fe74b80c5c921263be3ffe7902
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2658718
Reviewed-by: Nancy Wang <nancylingwang@chromium.org>
Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#849624}
  • Loading branch information
Matthew Mourgos authored and Chromium LUCI CQ committed Feb 2, 2021
1 parent 876cea0 commit 37c93c0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chrome/browser/apps/icon_standardizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ bool IsIconCircleShaped(const gfx::ImageSkia& image) {

float scale = preview_diagonal / visible_icon_diagonal;

// If the visible icon requires too large of a scale, then the icon is small
// enough that it should not be considered circular. This also serves as a
// speculative crash fix by setting an upper limit on |scale| in the case it
// is too large. (crbug.com/1162155)
if (scale >= 1.6f)
return false;

gfx::Size scaled_icon_size =
gfx::ScaleToRoundedSize(rep.pixel_size(), scale);

Expand Down

0 comments on commit 37c93c0

Please sign in to comment.