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

Issue 2545523002: Fix RowSizeForBufferFormatChecked use of base/numerics (Closed)

Created:
4 years ago by jschuh
Modified:
4 years ago
Reviewers:
danakj
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix RowSizeForBufferFormatChecked use of base/numerics R=danakj@chromium.org TBR=danakj@chromium.org BUG=668713 Committed: https://crrev.com/8794c4be74f56e495da28f388ee30098dc16eb88 Cr-Commit-Position: refs/heads/master@{#435341}

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M ui/gfx/buffer_format_util.cc View 2 chunks +2 lines, -2 lines 1 comment Download

Messages

Total messages: 9 (3 generated)
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/2545523002/1
4 years ago (2016-11-30 17:22:22 UTC) #2
jschuh
danakj@ - This cleanup in preparation for landing this CL: https://codereview.chromium.org/2528243002/ It shouldn't alter the ...
4 years ago (2016-11-30 17:25:05 UTC) #3
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years ago (2016-11-30 18:23:34 UTC) #5
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/8794c4be74f56e495da28f388ee30098dc16eb88 Cr-Commit-Position: refs/heads/master@{#435341}
4 years ago (2016-11-30 18:28:03 UTC) #7
danakj
https://codereview.chromium.org/2545523002/diff/1/ui/gfx/buffer_format_util.cc File ui/gfx/buffer_format_util.cc (right): https://codereview.chromium.org/2545523002/diff/1/ui/gfx/buffer_format_util.cc#newcode56 ui/gfx/buffer_format_util.cc:56: *size_in_bytes = (checked_size & ~0x3).ValueOrDie(); I'm not clear why ...
4 years ago (2016-11-30 23:13:20 UTC) #8
jschuh
4 years ago (2016-11-30 23:21:35 UTC) #9
Message was sent while issue was closed.
On 2016/11/30 23:13:20, danakj wrote:
> https://codereview.chromium.org/2545523002/diff/1/ui/gfx/buffer_format_util.cc
> File ui/gfx/buffer_format_util.cc (right):
> 
>
https://codereview.chromium.org/2545523002/diff/1/ui/gfx/buffer_format_util.c...
> ui/gfx/buffer_format_util.cc:56: *size_in_bytes = (checked_size &
> ~0x3).ValueOrDie();
> I'm not clear why this is better. bitmask operations will not overflow.

You are totally correct. The current code isn't wrong, and there's no added
checking on the "checked" bitwise operations (so there shouldn't be any added
overhead). But, the change clears a blocker for this CL:
https://codereview.chromium.org/2528243002/

The gist is that the CheckedNumeric value functions will be returning a proxy
class instead of the raw value, so it can detect truncations. But, I didn't want
to add math operations to the proxy class, because I want to restrict the math
to the CheckedNumeric class.

Powered by Google App Engine
This is Rietveld 408576698