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

Issue 2160983007: Avoid integer overflow in LayoutUnit's unary minus operator (Closed)

Created:
4 years, 5 months ago by Xianzhu
Modified:
4 years, 4 months ago
Reviewers:
pdr., esprehn, eae
CC:
blink-reviews, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid integer overflow in LayoutUnit's unary minus operator BUG=629932 Committed: https://crrev.com/ef6bea224f0266018c3b4fc63262769020b9a4c2 Cr-Commit-Position: refs/heads/master@{#406734}

Patch Set 1 #

Total comments: 3

Patch Set 2 : Full UnaryMinus test case #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -0 lines) Patch
M third_party/WebKit/Source/platform/LayoutUnit.h View 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/LayoutUnitTest.cpp View 1 1 chunk +15 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (12 generated)
Xianzhu
4 years, 5 months ago (2016-07-20 20:59:43 UTC) #2
pdr.
https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp File third_party/WebKit/Source/platform/LayoutUnitTest.cpp (right): https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp#newcode259 third_party/WebKit/Source/platform/LayoutUnitTest.cpp:259: TEST(LayoutUnitTest, UnaryMinusSaturated) What about -(LayoutUnit::min + 1)?
4 years, 5 months ago (2016-07-20 21:03:55 UTC) #5
Xianzhu
https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp File third_party/WebKit/Source/platform/LayoutUnitTest.cpp (right): https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp#newcode259 third_party/WebKit/Source/platform/LayoutUnitTest.cpp:259: TEST(LayoutUnitTest, UnaryMinusSaturated) On 2016/07/20 21:03:55, pdr. wrote: > What ...
4 years, 5 months ago (2016-07-20 21:09:10 UTC) #6
Xianzhu
https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp File third_party/WebKit/Source/platform/LayoutUnitTest.cpp (right): https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp#newcode259 third_party/WebKit/Source/platform/LayoutUnitTest.cpp:259: TEST(LayoutUnitTest, UnaryMinusSaturated) On 2016/07/20 21:09:10, Xianzhu wrote: > On ...
4 years, 5 months ago (2016-07-20 21:19:20 UTC) #9
pdr.
On 2016/07/20 at 21:19:20, wangxianzhu wrote: > https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp > File third_party/WebKit/Source/platform/LayoutUnitTest.cpp (right): > > https://codereview.chromium.org/2160983007/diff/1/third_party/WebKit/Source/platform/LayoutUnitTest.cpp#newcode259 ...
4 years, 5 months ago (2016-07-20 22:00:50 UTC) #10
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/2160983007/20001
4 years, 5 months ago (2016-07-21 00:52:37 UTC) #14
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 5 months ago (2016-07-21 00:59:26 UTC) #17
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/ef6bea224f0266018c3b4fc63262769020b9a4c2 Cr-Commit-Position: refs/heads/master@{#406734}
4 years, 5 months ago (2016-07-21 01:03:07 UTC) #19
esprehn
Why does this matter for real content? It's not clear to me that we should ...
4 years, 5 months ago (2016-07-21 01:57:31 UTC) #21
pdr.
On 2016/07/21 at 01:57:31, esprehn wrote: > Why does this matter for real content? It's ...
4 years, 5 months ago (2016-07-21 02:06:28 UTC) #22
Xianzhu
On 2016/07/21 02:06:28, pdr. wrote: > On 2016/07/21 at 01:57:31, esprehn wrote: > > Why ...
4 years, 5 months ago (2016-07-21 06:11:50 UTC) #23
esprehn
4 years, 5 months ago (2016-07-21 06:17:09 UTC) #24
Message was sent while issue was closed.
On 2016/07/21 at 06:11:50, wangxianzhu wrote:
> On 2016/07/21 02:06:28, pdr. wrote:
> > On 2016/07/21 at 01:57:31, esprehn wrote:
> > > Why does this matter for real content? It's not clear to me that we should
be
> > taking a branch for behavior that no real page ever hits and that isn't a
> > security bug.
> > 
> > In reviewing this, my thinking was that security bugs frequently come from
> > mistakes in over/underflow so it's better to be safe with consistent
behavior.
> > I'm not dead-set on that though, especially if it hurts performance (and
> > saturated arithmetic can actually cause security bugs too).
> > 
> > Do you think it would be okay to wait and see how this performs on the perf
> > bots?
> 
> I agree with pdr@ about consistent behavior (saturated arithmetic for
LayoutUnits). This CL makes the negative operator behaves consistently with
other operators.
> 
> However, I wonder how saturated or overflowed arithmetic of LayoutUnits
affects security. Is there any material about this? If saturated arithmetic is
just to handle cases that no real page ever hits and there is no security
concern, how about removing all the saturated arithmetic for LayoutUnits?

Layout does hit it as the result of some algorithms which use very large values.
Thinking about this, why can't we use saturatedSubtraction in unary minus like
plus uses saturatedAddition? That has special assembly for ARM.

Powered by Google App Engine
This is Rietveld 408576698