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

Issue 1158433010: Reland: cc: Fix size_t to int truncations in layers/ output/ playback/ quads/ (Closed)

Created:
5 years, 6 months ago by vmpstr
Modified:
5 years, 4 months ago
Reviewers:
danakj, jschuh, Nico, Mike West, sky
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

Reland: cc: Fix size_t to int truncations in layers/ output/ playback/ quads/ This patch fixes size_t to int truncations in layers/, output/, playback/, and quads/ directories in cc/. R=danakj BUG=167187 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel;tryserver.chromium.win:win_chromium_gn_x64_dbg Committed: https://crrev.com/0d5963315aa03e6ebb20351f13d3d517ca14d816 Cr-Commit-Position: refs/heads/master@{#333153} Committed: https://crrev.com/91e2309abe88d9a333deaf4714d0c48f875ba472 Cr-Commit-Position: refs/heads/master@{#333362}

Patch Set 1 #

Total comments: 2

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : compile_fix #

Patch Set 5 : compile fix #

Patch Set 6 : yet another compile fix #

Patch Set 7 : compile fix #

Patch Set 8 : #

Patch Set 9 : #

Patch Set 10 : #

Total comments: 4

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : mojo update #

Total comments: 2

Patch Set 14 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -90 lines) Patch
M cc/layers/delegated_renderer_layer_impl.h View 1 chunk +3 lines, -1 line 0 comments Download
M cc/layers/delegated_renderer_layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 7 chunks +14 lines, -9 lines 0 comments Download
M cc/layers/delegated_renderer_layer_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +17 lines, -17 lines 0 comments Download
M cc/layers/heads_up_display_layer_impl.cc View 1 2 3 4 5 6 7 8 3 chunks +5 lines, -2 lines 0 comments Download
M cc/layers/layer.h View 1 chunk +0 lines, -3 lines 0 comments Download
M cc/layers/layer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +12 lines, -18 lines 0 comments Download
M cc/layers/layer_impl.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -1 line 0 comments Download
M cc/layers/layer_iterator.h View 1 2 3 2 chunks +9 lines, -7 lines 0 comments Download
M cc/output/direct_renderer.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -2 lines 0 comments Download
M cc/output/gl_renderer.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -1 line 2 comments Download
M cc/playback/display_item_list.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download
M cc/quads/render_pass.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M cc/quads/render_pass.cc View 1 2 3 4 5 6 7 8 6 chunks +6 lines, -9 lines 0 comments Download
M cc/quads/render_pass_draw_quad.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +1 line, -4 lines 0 comments Download
M cc/quads/render_pass_id.h View 1 2 3 4 5 1 chunk +3 lines, -2 lines 0 comments Download
M cc/quads/render_pass_id.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M cc/surfaces/surface_aggregator_test_helpers.h View 1 2 3 4 5 6 7 1 chunk +1 line, -5 lines 0 comments Download
M components/view_manager/public/interfaces/quads.mojom View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -1 line 0 comments Download
M content/common/cc_messages.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M mojo/converters/surfaces/surfaces_type_converters.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -1 line 0 comments Download
M mojo/converters/surfaces/tests/surface_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 60 (21 generated)
vmpstr
Please take a look.
5 years, 6 months ago (2015-06-02 00:01:13 UTC) #1
danakj
LGTM https://codereview.chromium.org/1158433010/diff/1/cc/layers/layer.cc File cc/layers/layer.cc (right): https://codereview.chromium.org/1158433010/diff/1/cc/layers/layer.cc#newcode347 cc/layers/layer.cc:347: NOTREACHED(); Oh, yuck. Can you just DCHECK(reference_it != ...
5 years, 6 months ago (2015-06-02 00:06:27 UTC) #2
vmpstr
https://codereview.chromium.org/1158433010/diff/1/cc/layers/layer.cc File cc/layers/layer.cc (right): https://codereview.chromium.org/1158433010/diff/1/cc/layers/layer.cc#newcode347 cc/layers/layer.cc:347: NOTREACHED(); On 2015/06/02 00:06:27, danakj wrote: > Oh, yuck. ...
5 years, 6 months ago (2015-06-02 00:21:11 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/60001
5 years, 6 months ago (2015-06-02 00:55:41 UTC) #6
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/64694)
5 years, 6 months ago (2015-06-02 01:42:05 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/80001
5 years, 6 months ago (2015-06-02 18:04:45 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_rel on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/89494)
5 years, 6 months ago (2015-06-02 19:10:50 UTC) #13
vmpstr
There were a few compiler errors that I had to fix, so this patch looks ...
5 years, 6 months ago (2015-06-02 20:20:57 UTC) #14
danakj
LGTM
5 years, 6 months ago (2015-06-02 20:40:50 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/100001
5 years, 6 months ago (2015-06-02 20:43:01 UTC) #17
vmpstr
+mkwst for cc_messages. Please take a look.
5 years, 6 months ago (2015-06-02 20:56:05 UTC) #19
vmpstr
+jschuh as well, mkwst or jschuh, please take a look at cc_messages.
5 years, 6 months ago (2015-06-03 23:39:17 UTC) #21
jschuh
Converting these indeces into signed integers creates the potential for invalid comparisons and truncations at ...
5 years, 6 months ago (2015-06-04 00:18:17 UTC) #22
vmpstr
On 2015/06/04 00:18:17, jschuh wrote: > Converting these indeces into signed integers creates the potential ...
5 years, 6 months ago (2015-06-04 00:22:15 UTC) #23
jschuh
On 2015/06/04 00:22:15, vmpstr wrote: > On 2015/06/04 00:18:17, jschuh wrote: > > Converting these ...
5 years, 6 months ago (2015-06-04 03:01:00 UTC) #24
vmpstr
> There's two things that concern me. First, using static_cast rather than > base::checked_cast for ...
5 years, 6 months ago (2015-06-04 17:09:38 UTC) #25
danakj
On 2015/06/04 00:18:17, jschuh wrote: > Converting these indeces into signed integers creates the potential ...
5 years, 6 months ago (2015-06-04 17:11:12 UTC) #26
vmpstr
Please take another look. After an offline discussion, we agreed to use saturated_cast/checked_cast/CheckedNumeric where appropriate, ...
5 years, 6 months ago (2015-06-05 01:03:00 UTC) #29
jschuh
lgtm with a comment for a follow up https://codereview.chromium.org/1158433010/diff/220001/cc/output/gl_renderer.cc File cc/output/gl_renderer.cc (right): https://codereview.chromium.org/1158433010/diff/220001/cc/output/gl_renderer.cc#newcode2237 cc/output/gl_renderer.cc:2237: 6 ...
5 years, 6 months ago (2015-06-05 14:08:25 UTC) #30
danakj
LGTM https://codereview.chromium.org/1158433010/diff/220001/cc/output/gl_renderer.cc File cc/output/gl_renderer.cc (right): https://codereview.chromium.org/1158433010/diff/220001/cc/output/gl_renderer.cc#newcode2237 cc/output/gl_renderer.cc:2237: 6 * base::checked_cast<int>(draw_cache_.matrix_data.size()), matrix_data.size() is at most 8 ...
5 years, 6 months ago (2015-06-05 18:22:30 UTC) #31
vmpstr
https://codereview.chromium.org/1158433010/diff/220001/cc/output/gl_renderer.cc File cc/output/gl_renderer.cc (right): https://codereview.chromium.org/1158433010/diff/220001/cc/output/gl_renderer.cc#newcode2237 cc/output/gl_renderer.cc:2237: 6 * base::checked_cast<int>(draw_cache_.matrix_data.size()), On 2015/06/05 18:22:29, danakj wrote: > ...
5 years, 6 months ago (2015-06-05 19:27:34 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/260001
5 years, 6 months ago (2015-06-05 19:31:57 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_rel on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_rel/builds/91074)
5 years, 6 months ago (2015-06-05 21:18:56 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/260001
5 years, 6 months ago (2015-06-05 21:44:18 UTC) #39
commit-bot: I haz the power
Committed patchset #12 (id:260001)
5 years, 6 months ago (2015-06-05 22:27:57 UTC) #40
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/0d5963315aa03e6ebb20351f13d3d517ca14d816 Cr-Commit-Position: refs/heads/master@{#333153}
5 years, 6 months ago (2015-06-05 22:28:56 UTC) #41
vmpstr
A revert of this CL (patchset #12 id:260001) has been created in https://codereview.chromium.org/1155553006/ by vmpstr@chromium.org. ...
5 years, 6 months ago (2015-06-05 23:01:41 UTC) #42
vmpstr
+sky, please take a look at the mojo bits (mojo/converters and components/view_manager)
5 years, 6 months ago (2015-06-06 00:10:42 UTC) #43
vmpstr
+sky for real (please take a look at mojo parts of the change)
5 years, 6 months ago (2015-06-06 00:11:37 UTC) #45
sky
https://codereview.chromium.org/1158433010/diff/280001/components/view_manager/public/interfaces/quads.mojom File components/view_manager/public/interfaces/quads.mojom (right): https://codereview.chromium.org/1158433010/diff/280001/components/view_manager/public/interfaces/quads.mojom#newcode23 components/view_manager/public/interfaces/quads.mojom:23: uint32 index; Seems wrong to have this and RenderPassId::index ...
5 years, 6 months ago (2015-06-08 14:53:14 UTC) #46
vmpstr
https://codereview.chromium.org/1158433010/diff/280001/components/view_manager/public/interfaces/quads.mojom File components/view_manager/public/interfaces/quads.mojom (right): https://codereview.chromium.org/1158433010/diff/280001/components/view_manager/public/interfaces/quads.mojom#newcode23 components/view_manager/public/interfaces/quads.mojom:23: uint32 index; On 2015/06/08 14:53:13, sky wrote: > Seems ...
5 years, 6 months ago (2015-06-08 18:59:27 UTC) #47
sky
I don't think we would ever add size_t as it depends upon compile time flags, ...
5 years, 6 months ago (2015-06-08 20:01:14 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/300001
5 years, 6 months ago (2015-06-08 21:45:48 UTC) #51
commit-bot: I haz the power
Transient error: Too many "tryserver.blink:linux_blink_rel, tryserver.chromium.win:win_chromium_gn_x64_dbg" delimiters in ":". Correct syntax is "tryserver:bot1,bot2;tryserver2:bot3,bot4;".
5 years, 6 months ago (2015-06-08 21:46:00 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1158433010/300001
5 years, 6 months ago (2015-06-08 21:47:39 UTC) #55
commit-bot: I haz the power
Committed patchset #14 (id:300001)
5 years, 6 months ago (2015-06-08 22:24:24 UTC) #56
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/91e2309abe88d9a333deaf4714d0c48f875ba472 Cr-Commit-Position: refs/heads/master@{#333362}
5 years, 6 months ago (2015-06-08 22:25:26 UTC) #57
Nico
https://codereview.chromium.org/1158433010/diff/300001/cc/output/gl_renderer.cc File cc/output/gl_renderer.cc (right): https://codereview.chromium.org/1158433010/diff/300001/cc/output/gl_renderer.cc#newcode2243 cc/output/gl_renderer.cc:2243: static_cast<size_t>(std::numeric_limits<int>::max()) / 6u); shouldn't this check that size() is ...
5 years, 4 months ago (2015-07-31 17:57:15 UTC) #59
vmpstr
5 years, 4 months ago (2015-07-31 18:29:31 UTC) #60
Message was sent while issue was closed.
https://codereview.chromium.org/1158433010/diff/300001/cc/output/gl_renderer.cc
File cc/output/gl_renderer.cc (right):

https://codereview.chromium.org/1158433010/diff/300001/cc/output/gl_renderer....
cc/output/gl_renderer.cc:2243:
static_cast<size_t>(std::numeric_limits<int>::max()) / 6u);
On 2015/07/31 17:57:15, Nico (hiding) wrote:
> shouldn't this check that size() is lessequal than 8? StaticGeometry only sets
> up indices for at most 8 triangles as far as I can tell.

Yeah, I think that's clearly a much tighter bound. The intent of this check is
to simply guard against overflow in a call below, so the code is free to have
larger size, if at all possible, as long as it doesn't cause an overflow. But
you're absolutely right that we should probably use as tight of a bound as we
can here.

Powered by Google App Engine
This is Rietveld 408576698