Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Issue 2268423003: Adjust gfx::Rect's width and height to avoid integer overflow (Closed)

Created:
4 years, 4 months ago by sunxd
Modified:
4 years, 3 months ago
Reviewers:
danakj, ajuma, jbroman
CC:
chromium-reviews, cc-bugs_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Adjust gfx::Rect's width and height to avoid integer overflow It is possible that the origin plus the bounds of a gfx::Rect can exceed the range of an integer, as reflected in clusterfuzz. This CL makes gfx::Rect adjust the width and height if origin + bounds can result in an overflow. BUG=637985 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel Committed: https://crrev.com/86fc67cca4eaad94ec7bf3daebf905939abdd03c Cr-Commit-Position: refs/heads/master@{#416118}

Patch Set 1 #

Patch Set 2 : Fix gfx::Rect::Union instead #

Total comments: 10

Patch Set 3 : Rect ctor validates y + height against integer overflow. #

Patch Set 4 : Also fix width #

Total comments: 6

Patch Set 5 : Fix set functions. #

Patch Set 6 : Add corresponding test. #

Patch Set 7 : Remove repeated test case. #

Total comments: 12

Patch Set 8 : Resolve comments #

Patch Set 9 : Make GetClampedValue static. #

Patch Set 10 : Try to bypass the compiler's optimization check #

Patch Set 11 : Sometimes size could be negative... #

Total comments: 1

Patch Set 12 : Add comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+133 lines, -9 lines) Patch
M ui/gfx/geometry/rect.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +50 lines, -9 lines 0 comments Download
M ui/gfx/geometry/rect.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -0 lines 0 comments Download
M ui/gfx/geometry/rect_unittest.cc View 1 2 3 4 5 6 7 1 chunk +77 lines, -0 lines 0 comments Download

Messages

Total messages: 49 (21 generated)
sunxd
Finally I think we should response the clusterfuzz failure with a temp fix. But I'm ...
4 years, 4 months ago (2016-08-23 17:11:54 UTC) #3
danakj
On Tue, Aug 23, 2016 at 10:11 AM, <sunxd@chromium.org> wrote: > Reviewers: danakj, ajuma, jbroman ...
4 years, 4 months ago (2016-08-23 17:13:26 UTC) #4
sunxd
On 2016/08/23 17:13:26, danakj wrote: > On Tue, Aug 23, 2016 at 10:11 AM, <mailto:sunxd@chromium.org> ...
4 years, 4 months ago (2016-08-23 17:17:01 UTC) #5
danakj
On Tue, Aug 23, 2016 at 10:17 AM, <sunxd@chromium.org> wrote: > On 2016/08/23 17:13:26, danakj ...
4 years, 4 months ago (2016-08-23 17:19:32 UTC) #6
sunxd
4 years, 4 months ago (2016-08-23 17:37:55 UTC) #7
danakj
https://codereview.chromium.org/2268423003/diff/20001/ui/gfx/geometry/rect.cc File ui/gfx/geometry/rect.cc (right): https://codereview.chromium.org/2268423003/diff/20001/ui/gfx/geometry/rect.cc#newcode148 ui/gfx/geometry/rect.cc:148: // integer. This hack should be removed if root ...
4 years, 4 months ago (2016-08-23 17:47:56 UTC) #8
sunxd
https://codereview.chromium.org/2268423003/diff/20001/ui/gfx/geometry/rect.cc File ui/gfx/geometry/rect.cc (right): https://codereview.chromium.org/2268423003/diff/20001/ui/gfx/geometry/rect.cc#newcode148 ui/gfx/geometry/rect.cc:148: // integer. This hack should be removed if root ...
4 years, 4 months ago (2016-08-23 19:08:24 UTC) #9
danakj
https://codereview.chromium.org/2268423003/diff/20001/ui/gfx/geometry/rect.cc File ui/gfx/geometry/rect.cc (right): https://codereview.chromium.org/2268423003/diff/20001/ui/gfx/geometry/rect.cc#newcode149 ui/gfx/geometry/rect.cc:149: int64_t right = static_cast<int64_t>(x()) + width(); On 2016/08/23 19:08:24, ...
4 years, 4 months ago (2016-08-23 19:25:13 UTC) #10
sunxd
The clusterfuzz test case breaks by calling the Rect(x, y, w, h) function with a ...
4 years, 4 months ago (2016-08-24 20:54:10 UTC) #11
danakj
On Wed, Aug 24, 2016 at 1:54 PM, <sunxd@chromium.org> wrote: > The clusterfuzz test case ...
4 years, 4 months ago (2016-08-24 20:59:07 UTC) #12
chromium-reviews
On Wed, Aug 24, 2016 at 4:59 PM <danakj@chromium.org> wrote: > On Wed, Aug 24, ...
4 years, 4 months ago (2016-08-24 21:02:17 UTC) #13
danakj
On Wed, Aug 24, 2016 at 2:02 PM, 'Xianda Sun' via cc-bugs < cc-bugs@chromium.org> wrote: ...
4 years, 4 months ago (2016-08-24 22:11:52 UTC) #14
sunxd
4 years, 3 months ago (2016-08-25 15:28:31 UTC) #15
danakj
when you publish a new patch you can say "PTAL" or something about what you're ...
4 years, 3 months ago (2016-08-25 17:59:21 UTC) #16
sunxd
https://codereview.chromium.org/2268423003/diff/60001/ui/gfx/geometry/rect.h File ui/gfx/geometry/rect.h (right): https://codereview.chromium.org/2268423003/diff/60001/ui/gfx/geometry/rect.h#newcode35 ui/gfx/geometry/rect.h:35: #define GetClampedValue(origin, size) \ On 2016/08/25 17:59:21, danakj wrote: ...
4 years, 3 months ago (2016-08-25 19:25:10 UTC) #17
sunxd
PTAL.
4 years, 3 months ago (2016-08-25 22:22:19 UTC) #18
sunxd
Modify the CL description.
4 years, 3 months ago (2016-08-29 18:27:04 UTC) #20
danakj
Thanks! A couple more methods and I think it'll be good. https://codereview.chromium.org/2268423003/diff/120001/ui/gfx/geometry/rect.h File ui/gfx/geometry/rect.h (right): ...
4 years, 3 months ago (2016-08-29 19:51:01 UTC) #21
sunxd
PTAL https://codereview.chromium.org/2268423003/diff/120001/ui/gfx/geometry/rect.h File ui/gfx/geometry/rect.h (right): https://codereview.chromium.org/2268423003/diff/120001/ui/gfx/geometry/rect.h#newcode65 ui/gfx/geometry/rect.h:65: size_.set_width(GetClampedValue(x, size_.width())); On 2016/08/29 19:51:01, danakj wrote: > ...
4 years, 3 months ago (2016-08-29 21:23:06 UTC) #22
danakj
LGTM
4 years, 3 months ago (2016-08-29 23:58:34 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2268423003/140001
4 years, 3 months ago (2016-08-30 00:21:17 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/120432) android_compile_dbg on master.tryserver.chromium.android (JOB_FAILED, ...
4 years, 3 months ago (2016-08-30 03:30:00 UTC) #27
sunxd
On 2016/08/30 03:30:00, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 3 months ago (2016-08-30 15:15:08 UTC) #28
sunxd
The compiler sometimes knows every value (const) when calling the ctor of gfx::Rect, it tries ...
4 years, 3 months ago (2016-08-31 20:21:24 UTC) #41
danakj
LGTM https://codereview.chromium.org/2268423003/diff/200001/ui/gfx/geometry/rect.h File ui/gfx/geometry/rect.h (right): https://codereview.chromium.org/2268423003/diff/200001/ui/gfx/geometry/rect.h#newcode210 ui/gfx/geometry/rect.h:210: return origin > 0 && size > 0 ...
4 years, 3 months ago (2016-09-01 20:22:40 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2268423003/220001
4 years, 3 months ago (2016-09-01 21:42:30 UTC) #45
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 3 months ago (2016-09-01 23:28:24 UTC) #47
commit-bot: I haz the power
4 years, 3 months ago (2016-09-01 23:31:38 UTC) #49
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/86fc67cca4eaad94ec7bf3daebf905939abdd03c
Cr-Commit-Position: refs/heads/master@{#416118}

Powered by Google App Engine
This is Rietveld 408576698