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

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)

Created:
4 years ago by jschuh
Modified:
4 years ago
CC:
ajuma+watch_chromium.org, blink-reviews, blink-reviews-html_chromium.org, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, darin-cc_chromium.org, dglazkov+blink, dshwang, drott+blinkwatch_chromium.org, krit, feature-media-reviews_chromium.org, f(malita), haraken, huangs+watch_chromium.org, jam, jbroman, jshin+watch_chromium.org, Justin Novosad, michaeln, mlamouri+watch-content_chromium.org, pdr+graphicswatchlist_chromium.org, pennymac+watch_chromium.org, piman+watch_chromium.org, posciak+watch_chromium.org, rickyz+watch_chromium.org, rwlbuis, Stephen Chennney, vmpstr+watch_chromium.org, wfh+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix silent truncations when extracting values from CheckedNumeric This CL does a few closely intertwined things: - CheckedNumeric value functions now return a StrictNumeric proxy class - ValueFloating function is now removed (it was unused) - StrictNumeric now supports comparisons, ostream, and pointer math - Remaining callsites are fixed to support the new proxy class TBR=vmiura@chromium.org,nparker@chromium.org BUG=668713 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Committed: https://crrev.com/23a4b06b83fe4b11f6d5a48078eb543ea88c747b Cr-Commit-Position: refs/heads/master@{#435834}

Patch Set 1 #

Patch Set 2 : const l-value fixes #

Patch Set 3 : revert lvalue change #

Patch Set 4 : kill real_value #

Patch Set 5 : compile fix #

Patch Set 6 : compile-time const #

Patch Set 7 : compile cleanup and fix #

Total comments: 6

Patch Set 8 : various refactoring and splitting out #

Patch Set 9 : docs #

Patch Set 10 : pointer math tests #

Total comments: 13

Patch Set 11 : fixes #

Total comments: 4

Patch Set 12 : nits, tests, mac fix, cros fix #

Patch Set 13 : i wish i had a mac to test this on locally #

Patch Set 14 : reducing type overloads #

Patch Set 15 : compile fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+719 lines, -302 lines) Patch
M base/numerics/safe_conversions.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 chunks +114 lines, -21 lines 0 comments Download
M base/numerics/safe_conversions_impl.h View 1 2 3 4 5 6 2 chunks +381 lines, -2 lines 0 comments Download
M base/numerics/safe_math.h View 1 2 3 4 5 6 7 8 9 10 7 chunks +64 lines, -24 lines 0 comments Download
M base/numerics/safe_math_impl.h View 1 2 3 4 3 chunks +0 lines, -198 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 16 chunks +111 lines, -19 lines 0 comments Download
M chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/utility/safe_browsing/mac/hfs.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +6 lines, -6 lines 0 comments Download
M chrome/utility/safe_browsing/mac/udif.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -1 line 0 comments Download
M components/webcrypto/algorithms/aes_cbc.cc View 1 2 3 4 5 6 7 3 chunks +4 lines, -2 lines 0 comments Download
M components/webcrypto/algorithms/aes_ctr.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/pepper/pepper_audio_encoder_host.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +11 lines, -9 lines 0 comments Download
M content/renderer/pepper/pepper_media_stream_track_host_base.cc View 1 chunk +1 line, -1 line 0 comments Download
M device/hid/hid_connection_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -4 lines 0 comments Download
M gpu/command_buffer/client/gles2_implementation.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M gpu/command_buffer/service/gles2_cmd_decoder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +8 lines, -4 lines 0 comments Download
M media/base/video_util.cc View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/crashpad/README.chromium View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/crashpad/crashpad/util/file/string_file.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -4 lines 0 comments Download

Messages

Total messages: 64 (40 generated)
Tom Sepez
https://codereview.chromium.org/2528243002/diff/200001/base/numerics/safe_conversions.h File base/numerics/safe_conversions.h (right): https://codereview.chromium.org/2528243002/diff/200001/base/numerics/safe_conversions.h#newcode211 base/numerics/safe_conversions.h:211: // We allow simple pointer arithmetic. For extra credit: ...
4 years ago (2016-11-29 20:06:26 UTC) #7
jschuh
https://codereview.chromium.org/2528243002/diff/200001/base/numerics/safe_conversions.h File base/numerics/safe_conversions.h (right): https://codereview.chromium.org/2528243002/diff/200001/base/numerics/safe_conversions.h#newcode211 base/numerics/safe_conversions.h:211: // We allow simple pointer arithmetic. On 2016/11/29 20:06:26, ...
4 years ago (2016-11-29 21:04:47 UTC) #8
jschuh
I think this is ready for an actual review pass. All the remaining dependent CLs ...
4 years ago (2016-11-30 23:38:52 UTC) #21
Tom Sepez
https://codereview.chromium.org/2528243002/diff/440001/base/numerics/safe_conversions.h File base/numerics/safe_conversions.h (right): https://codereview.chromium.org/2528243002/diff/440001/base/numerics/safe_conversions.h#newcode30 base/numerics/safe_conversions.h:30: // The default CHECK triggers a crash, but the ...
4 years ago (2016-11-30 23:58:27 UTC) #22
jschuh
ptal https://codereview.chromium.org/2528243002/diff/440001/base/numerics/safe_conversions.h File base/numerics/safe_conversions.h (right): https://codereview.chromium.org/2528243002/diff/440001/base/numerics/safe_conversions.h#newcode30 base/numerics/safe_conversions.h:30: // The default CHECK triggers a crash, but ...
4 years ago (2016-12-01 00:58:56 UTC) #23
Tom Sepez
lgtm
4 years ago (2016-12-01 01:00:15 UTC) #24
danakj
https://codereview.chromium.org/2528243002/diff/440001/base/numerics/safe_numerics_unittest.cc File base/numerics/safe_numerics_unittest.cc (right): https://codereview.chromium.org/2528243002/diff/440001/base/numerics/safe_numerics_unittest.cc#newcode127 base/numerics/safe_numerics_unittest.cc:127: } On 2016/12/01 00:58:55, jschuh (very slow) wrote: > ...
4 years ago (2016-12-01 01:00:25 UTC) #25
jschuh
PTAL - These should all be mechanical changes that don't have any real impact on ...
4 years ago (2016-12-01 01:13:56 UTC) #27
Ryan Sleevi
lgtm
4 years ago (2016-12-01 01:19:54 UTC) #28
Tom Sepez
NIT: Update CL description to not say WIP.
4 years ago (2016-12-01 01:30:04 UTC) #29
bbudge
content/renderer/pepper lgtm w/2 comments https://codereview.chromium.org/2528243002/diff/460001/content/renderer/pepper/pepper_audio_encoder_host.cc File content/renderer/pepper/pepper_audio_encoder_host.cc (right): https://codereview.chromium.org/2528243002/diff/460001/content/renderer/pepper/pepper_audio_encoder_host.cc#newcode376 content/renderer/pepper/pepper_audio_encoder_host.cc:376: base::ValueOrDieForType<int>(total_audio_buffer_size), Why not int32_t? https://codereview.chromium.org/2528243002/diff/460001/content/renderer/pepper/pepper_audio_encoder_host.cc#newcode401 ...
4 years ago (2016-12-01 01:51:45 UTC) #33
DaleCurtis
lgtm
4 years ago (2016-12-01 05:05:36 UTC) #36
jschuh
Had to fix a few more call sites. So, adding some more reviewers, but these ...
4 years ago (2016-12-01 07:06:04 UTC) #41
mtomasz
lgtm
4 years ago (2016-12-01 07:08:21 UTC) #44
jschuh
tsepez@ - I just realized I can specialize the StrictNumeric conversion operator to only the ...
4 years ago (2016-12-01 15:24:29 UTC) #47
Ken Rockot(use gerrit already)
lgtm
4 years ago (2016-12-01 17:57:53 UTC) #48
scottmg
crashpad lgtm
4 years ago (2016-12-01 20:16:00 UTC) #49
jschuh
Since the two outstanding reviews are mechanical changes, I'm just going to TBR this.
4 years ago (2016-12-01 23:06:40 UTC) #51
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/2528243002/570001
4 years ago (2016-12-01 23:07:42 UTC) #54
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/325676) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, ...
4 years ago (2016-12-02 01:09:49 UTC) #56
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/2528243002/570001
4 years ago (2016-12-02 01:13:16 UTC) #58
commit-bot: I haz the power
Committed patchset #15 (id:570001)
4 years ago (2016-12-02 02:55:49 UTC) #61
commit-bot: I haz the power
Patchset 15 (id:??) landed as https://crrev.com/23a4b06b83fe4b11f6d5a48078eb543ea88c747b Cr-Commit-Position: refs/heads/master@{#435834}
4 years ago (2016-12-02 02:58:27 UTC) #63
Nathan Parker
4 years ago (2016-12-03 17:59:34 UTC) #64
Message was sent while issue was closed.
lgtm

Powered by Google App Engine
This is Rietveld 408576698