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

Issue 141583008: Add support for safe math operations in base/numerics (Closed)

Created:
6 years, 11 months ago by jschuh
Modified:
4 years, 11 months ago
Reviewers:
eustas, awong, Ryan Sleevi
CC:
chromium-reviews, erikwright+watch_chromium.org, Ryan Sleevi
Visibility:
Public.

Description

Add support for safe math operations in base/numerics Add checked numeric templates. BUG=332611 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=253789

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : WIP: Initial implementation #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Total comments: 1

Patch Set 8 : msvs 2010 fixes #

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : WIP: Fixed floating piont constructor #

Patch Set 12 : Arithmetic tests and a float range fix #

Patch Set 13 : #

Patch Set 14 : #

Patch Set 15 : #

Patch Set 16 : #

Patch Set 17 : #

Patch Set 18 : Documentation and re-added ValueFloating. #

Total comments: 21

Patch Set 19 : style fixes #

Total comments: 39

Patch Set 20 : WIP: Actioned comments #

Patch Set 21 : Actioned feedback (really I swear) #

Total comments: 23

Patch Set 22 : Actioned feedback #

Total comments: 6

Patch Set 23 : Nits #

Patch Set 24 : clang fix #

Patch Set 25 : Fix x64 _mm_empty #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+1296 lines, -186 lines) Patch
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -0 lines 0 comments Download
M base/numerics/safe_conversions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +7 lines, -6 lines 0 comments Download
M base/numerics/safe_conversions_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +147 lines, -113 lines 0 comments Download
A base/numerics/safe_math.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +271 lines, -0 lines 1 comment Download
A base/numerics/safe_math_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +502 lines, -0 lines 0 comments Download
M base/numerics/safe_numerics_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 14 chunks +367 lines, -67 lines 0 comments Download

Messages

Total messages: 37 (1 generated)
Ryan Sleevi
https://codereview.chromium.org/141583008/diff/660001/base/numerics/safe_math_impl.h File base/numerics/safe_math_impl.h (right): https://codereview.chromium.org/141583008/diff/660001/base/numerics/safe_math_impl.h#newcode340 base/numerics/safe_math_impl.h:340: } So, templated CTORS = generally a bad/tricky thing ...
6 years, 10 months ago (2014-02-05 02:45:06 UTC) #1
jschuh
This is either ready to review or I'm ready to give up for now (probably ...
6 years, 10 months ago (2014-02-10 22:32:39 UTC) #2
Ryan Sleevi
Math is hard! Can I go shopping? Note I just reviewed the C++ Template foo ...
6 years, 10 months ago (2014-02-10 23:42:40 UTC) #3
jschuh
https://codereview.chromium.org/141583008/diff/1400001/base/numerics/safe_conversions_impl.h File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/141583008/diff/1400001/base/numerics/safe_conversions_impl.h#newcode25 base/numerics/safe_conversions_impl.h:25: SRC_SIGNED = 1 On 2014/02/10 23:42:41, Ryan Sleevi wrote: ...
6 years, 10 months ago (2014-02-11 00:43:28 UTC) #4
awong
Still looking through, but here are initial comments. https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_conversions_impl.h File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_conversions_impl.h#newcode18 base/numerics/safe_conversions_impl.h:18: enum ...
6 years, 10 months ago (2014-02-11 19:40:10 UTC) #5
awong
more comments. You should probably find me over chat. https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_math.h File base/numerics/safe_math.h (right): https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_math.h#newcode38 base/numerics/safe_math.h:38: ...
6 years, 10 months ago (2014-02-11 20:14:11 UTC) #6
awong
https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_math.h File base/numerics/safe_math.h (right): https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_math.h#newcode195 base/numerics/safe_math.h:195: #define BASE_NUMERIC_ARITHMETIC_OPERATORS( \ On 2014/02/11 19:40:10, awong wrote: > ...
6 years, 10 months ago (2014-02-11 21:02:11 UTC) #7
awong
On 2014/02/11 21:02:11, awong wrote: > https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_math.h > File base/numerics/safe_math.h (right): > > https://codereview.chromium.org/141583008/diff/1490001/base/numerics/safe_math.h#newcode195 > ...
6 years, 10 months ago (2014-02-11 21:02:25 UTC) #8
scottmg
See https://code.google.com/p/chromium/issues/detail?id=332611#c3 and #4 for details on failures seen running on VS2013.
6 years, 10 months ago (2014-02-18 19:46:27 UTC) #9
jschuh
I think we're good to go now. I've added TODOs for the things I will ...
6 years, 10 months ago (2014-02-21 19:22:27 UTC) #10
awong
next pass of comments. getting pretty close. https://codereview.chromium.org/141583008/diff/1750001/base/numerics/safe_conversions_impl.h File base/numerics/safe_conversions_impl.h (right): https://codereview.chromium.org/141583008/diff/1750001/base/numerics/safe_conversions_impl.h#newcode27 base/numerics/safe_conversions_impl.h:27: enum IntegerSignRepresentation ...
6 years, 10 months ago (2014-02-21 22:27:41 UTC) #11
Ryan Sleevi
So I think my brain is fried from the templates, but AFAICT, the templates are ...
6 years, 10 months ago (2014-02-24 23:37:44 UTC) #12
awong
He should land-and-optimize. :) On Mon, Feb 24, 2014 at 3:37 PM, <rsleevi@chromium.org> wrote: > ...
6 years, 10 months ago (2014-02-25 01:14:51 UTC) #13
jschuh
Sorry for the delay. I think I've actioned all the feedback and adequately marked the ...
6 years, 10 months ago (2014-02-25 22:34:42 UTC) #14
awong
3 more nits. https://codereview.chromium.org/141583008/diff/1860001/base/numerics/safe_math.h File base/numerics/safe_math.h (right): https://codereview.chromium.org/141583008/diff/1860001/base/numerics/safe_math.h#newcode46 base/numerics/safe_math.h:46: private: Private goes at the end. ...
6 years, 10 months ago (2014-02-25 22:41:01 UTC) #15
jschuh
https://codereview.chromium.org/141583008/diff/1860001/base/numerics/safe_math.h File base/numerics/safe_math.h (right): https://codereview.chromium.org/141583008/diff/1860001/base/numerics/safe_math.h#newcode46 base/numerics/safe_math.h:46: private: On 2014/02/25 22:41:02, awong wrote: > Private goes ...
6 years, 10 months ago (2014-02-25 22:56:16 UTC) #16
awong
LGTM. Ship it!
6 years, 10 months ago (2014-02-25 22:56:45 UTC) #17
jschuh
The CQ bit was checked by jschuh@chromium.org
6 years, 10 months ago (2014-02-25 22:58:25 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jschuh@chromium.org/141583008/1900001
6 years, 10 months ago (2014-02-26 00:22:43 UTC) #19
jschuh
The CQ bit was unchecked by jschuh@chromium.org
6 years, 10 months ago (2014-02-26 02:14:56 UTC) #20
jschuh
The CQ bit was checked by jschuh@chromium.org
6 years, 10 months ago (2014-02-26 20:08:00 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jschuh@chromium.org/141583008/1920001
6 years, 10 months ago (2014-02-26 20:12:47 UTC) #22
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-26 21:10:05 UTC) #23
commit-bot: I haz the power
Retried try job too often on ios_dbg_simulator for step(s) base_unittests, compile, components_unittests, content_unittests, crypto_unittests, net_unittests, ...
6 years, 10 months ago (2014-02-26 21:10:06 UTC) #24
jschuh
The CQ bit was checked by jschuh@chromium.org
6 years, 10 months ago (2014-02-26 22:56:04 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jschuh@chromium.org/141583008/1920001
6 years, 10 months ago (2014-02-26 22:57:44 UTC) #26
jschuh
The CQ bit was checked by jschuh@chromium.org
6 years, 10 months ago (2014-02-27 00:53:22 UTC) #27
jschuh
The CQ bit was unchecked by jschuh@chromium.org
6 years, 10 months ago (2014-02-27 00:54:02 UTC) #28
jschuh
The CQ bit was checked by jschuh@chromium.org
6 years, 10 months ago (2014-02-27 00:58:31 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jschuh@chromium.org/141583008/1950001
6 years, 10 months ago (2014-02-27 01:00:37 UTC) #30
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 10 months ago (2014-02-27 01:46:29 UTC) #31
commit-bot: I haz the power
Retried try job too often on ios_rel_device for step(s) compile http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=ios_rel_device&number=119595
6 years, 10 months ago (2014-02-27 01:46:30 UTC) #32
jschuh
The CQ bit was checked by jschuh@chromium.org
6 years, 10 months ago (2014-02-27 01:51:30 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jschuh@chromium.org/141583008/1970001
6 years, 10 months ago (2014-02-27 01:52:03 UTC) #34
commit-bot: I haz the power
Change committed as 253789
6 years, 9 months ago (2014-02-27 13:49:06 UTC) #35
eustas
4 years, 11 months ago (2015-12-30 10:17:58 UTC) #37
Message was sent while issue was closed.
https://codereview.chromium.org/141583008/diff/1970001/base/numerics/safe_math.h
File base/numerics/safe_math.h (right):

https://codereview.chromium.org/141583008/diff/1970001/base/numerics/safe_mat...
base/numerics/safe_math.h:39: //   CheckedNumeric<size_t> checked_size;
"checked_size" redeclaration looks a little bit confusing...

Powered by Google App Engine
This is Rietveld 408576698