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

Issue 1753293002: Safe numeric library: base/numerics (copied from Chromium) (Closed)

Created:
4 years, 9 months ago by hbos
Modified:
4 years, 9 months ago
CC:
webrtc-reviews_webrtc.org, kwiberg-webrtc, Andrew MacDonald, tlegrand-webrtc, tterriberry_mozilla.com, audio-team_agora.io, hlundin-webrtc, peah-webrtc, minyue-webrtc, the sun, aluebs-webrtc, bjornv1
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Safe numeric library added: base/numerics (copied from Chromium) This copies the contents (unittest excluded) of base/numerics in chromium to base/numerics in webrtc. Files added: - safe_conversions.h - safe_conversions_impl.h - safe_math.h - safe_math_impl.h A really old version of safe_conversions[_impl].h previously existed in base/, this has been deleted and sources using it have been updated to include the new base/numerics/safe_converions.h. This CL also adds a DEPS file to webrtc/base. NOPRESUBMIT=True BUG=webrtc:5548, webrtc:5623 Committed: https://crrev.com/de1c81b2d2196be611674aa6019b9db3a9329042 Cr-Commit-Position: refs/heads/master@{#11907}

Patch Set 1 : Original Chromium version of safe_conversions[_impl].h in base/numerics/ #

Patch Set 2 : safe_conversions[_impl].h updated for WebRTC (Check delta with PS1) #

Total comments: 6

Patch Set 3 : Original Chromium version of safe_math[_impl].h added #

Patch Set 4 : safe_math[_impl].h updated for WebRTC (Check delta with PS3) #

Total comments: 10

Patch Set 5 : Comment about chromium_revision #

Total comments: 9

Patch Set 6 : Moved safe_numerics, made it dep on rtc_base_approved, added DEPS #

Patch Set 7 : Corrected build files and addressed comments (removed explicit, updated includes, etc) #

Patch Set 8 : (Re-added "deps = []" I accidentally removed, would have broken chromium) #

Total comments: 4

Patch Set 9 : Addressed comments #

Total comments: 12

Patch Set 10 : Alphabetical sorting of includes #

Patch Set 11 : Rebase with master + correct new safe_conversions.h include #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1380 lines, -289 lines) Patch
M webrtc/base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 4 chunks +20 lines, -6 lines 0 comments Download
A webrtc/base/DEPS View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M webrtc/base/base.gyp View 1 2 3 4 5 6 7 8 9 10 4 chunks +15 lines, -4 lines 0 comments Download
A webrtc/base/numerics/safe_conversions.h View 1 2 3 4 5 6 7 8 1 chunk +175 lines, -0 lines 0 comments Download
A webrtc/base/numerics/safe_conversions_impl.h View 1 2 3 4 5 6 7 8 1 chunk +273 lines, -0 lines 0 comments Download
A webrtc/base/numerics/safe_math.h View 1 2 3 4 5 6 1 chunk +312 lines, -0 lines 0 comments Download
A webrtc/base/numerics/safe_math_impl.h View 1 2 3 4 5 6 1 chunk +556 lines, -0 lines 0 comments Download
M webrtc/base/openssladapter.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/opensslstreamadapter.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/rtccertificate_unittests.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
D webrtc/base/safe_conversions.h View 1 chunk +0 lines, -70 lines 0 comments Download
D webrtc/base/safe_conversions_impl.h View 1 chunk +0 lines, -188 lines 0 comments Download
M webrtc/common_audio/audio_converter.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/common_audio/wav_file.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/media/engine/webrtcvideocapturer.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M webrtc/media/sctp/sctpdataengine.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/acm2/acm_receiver.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/delay_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/expand.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/expand_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/neteq_impl.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/statistics_calculator.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/test/neteq_ilbc_quality_test.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/time_stretch.cc View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M webrtc/modules/audio_processing/audio_processing_performance_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 40 (17 generated)
hbos
Please take a look, kjellander & tommi. https://codereview.webrtc.org/1753293002/diff/120001/webrtc/base/numerics/BUILD.gn File webrtc/base/numerics/BUILD.gn (right): https://codereview.webrtc.org/1753293002/diff/120001/webrtc/base/numerics/BUILD.gn#newcode16 webrtc/base/numerics/BUILD.gn:16: ] Is ...
4 years, 9 months ago (2016-03-02 15:46:51 UTC) #5
tommi
https://codereview.webrtc.org/1753293002/diff/120001/webrtc/base/numerics/BUILD.gn File webrtc/base/numerics/BUILD.gn (right): https://codereview.webrtc.org/1753293002/diff/120001/webrtc/base/numerics/BUILD.gn#newcode16 webrtc/base/numerics/BUILD.gn:16: ] On 2016/03/02 15:46:51, hbos wrote: > Is this ...
4 years, 9 months ago (2016-03-02 16:13:53 UTC) #6
kjellander_webrtc
to protect against future updates missing to to similar updates, can you add a DEPS ...
4 years, 9 months ago (2016-03-02 18:40:05 UTC) #7
kwiberg-webrtc
Great initiative! Does Chromium have tests for these? If so, we should borrow those as ...
4 years, 9 months ago (2016-03-02 20:14:13 UTC) #9
kjellander_webrtc
Chromium has one unit test: https://code.google.com/p/chromium/codesearch#chromium/src/base/numerics/safe_numerics_unittest.cc but it's depending on a lot of other things ...
4 years, 9 months ago (2016-03-03 10:25:20 UTC) #10
hbos
PTAL everyone (tommi, kjellander, kwiberg) https://codereview.webrtc.org/1753293002/diff/60001/webrtc/base/numerics/safe_conversions.h File webrtc/base/numerics/safe_conversions.h (right): https://codereview.webrtc.org/1753293002/diff/60001/webrtc/base/numerics/safe_conversions.h#newcode127 webrtc/base/numerics/safe_conversions.h:127: "- base::CheckedNumeric"); On 2016/03/02 ...
4 years, 9 months ago (2016-03-03 14:17:07 UTC) #13
kwiberg-webrtc
https://codereview.webrtc.org/1753293002/diff/190001/webrtc/base/numerics/safe_conversions.h File webrtc/base/numerics/safe_conversions.h (right): https://codereview.webrtc.org/1753293002/diff/190001/webrtc/base/numerics/safe_conversions.h#newcode67 webrtc/base/numerics/safe_conversions.h:67: RTC_NOTREACHED(); This was CHECK(false) in the original. Why not ...
4 years, 9 months ago (2016-03-05 00:47:26 UTC) #14
hbos
https://codereview.webrtc.org/1753293002/diff/190001/webrtc/base/numerics/safe_conversions.h File webrtc/base/numerics/safe_conversions.h (right): https://codereview.webrtc.org/1753293002/diff/190001/webrtc/base/numerics/safe_conversions.h#newcode67 webrtc/base/numerics/safe_conversions.h:67: RTC_NOTREACHED(); On 2016/03/05 00:47:26, kwiberg-webrtc wrote: > This was ...
4 years, 9 months ago (2016-03-07 09:18:02 UTC) #15
kwiberg-webrtc
lgtm
4 years, 9 months ago (2016-03-07 14:20:40 UTC) #16
hbos
PTAL kjellander and tommi. Though tommi is travelling, not sure he does code reviews this ...
4 years, 9 months ago (2016-03-07 15:50:46 UTC) #17
tlegrand-webrtc
A small drive-by, since I saw that the includes were not always in alphabetic order. ...
4 years, 9 months ago (2016-03-07 16:27:18 UTC) #19
hbos
https://codereview.webrtc.org/1753293002/diff/210001/webrtc/base/openssladapter.cc File webrtc/base/openssladapter.cc (right): https://codereview.webrtc.org/1753293002/diff/210001/webrtc/base/openssladapter.cc#newcode41 webrtc/base/openssladapter.cc:41: #include "webrtc/base/numerics/safe_conversions.h" On 2016/03/07 16:27:17, tlegrand-webrtc wrote: > This ...
4 years, 9 months ago (2016-03-07 16:49:05 UTC) #20
kjellander_webrtc
On 2016/03/07 16:49:05, hbos wrote: > https://codereview.webrtc.org/1753293002/diff/210001/webrtc/base/openssladapter.cc > File webrtc/base/openssladapter.cc (right): > > https://codereview.webrtc.org/1753293002/diff/210001/webrtc/base/openssladapter.cc#newcode41 > ...
4 years, 9 months ago (2016-03-08 01:34:51 UTC) #21
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1753293002/230001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1753293002/230001
4 years, 9 months ago (2016-03-08 09:34:10 UTC) #23
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios64_sim_dbg on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/ios64_sim_dbg/builds/5758) mac_gn_dbg on ...
4 years, 9 months ago (2016-03-08 09:35:39 UTC) #25
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1753293002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1753293002/250001
4 years, 9 months ago (2016-03-08 10:27:31 UTC) #27
tlegrand-webrtc
Thanks! LGTM
4 years, 9 months ago (2016-03-08 10:33:02 UTC) #28
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: presubmit on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/presubmit/builds/3961)
4 years, 9 months ago (2016-03-08 10:36:45 UTC) #30
hbos
On 2016/03/08 10:36:45, commit-bot: I haz the power wrote: > Dry run: Try jobs failed ...
4 years, 9 months ago (2016-03-08 10:57:41 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1753293002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1753293002/250001
4 years, 9 months ago (2016-03-08 12:30:05 UTC) #35
commit-bot: I haz the power
Committed patchset #11 (id:250001)
4 years, 9 months ago (2016-03-08 12:46:05 UTC) #37
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/de1c81b2d2196be611674aa6019b9db3a9329042 Cr-Commit-Position: refs/heads/master@{#11907}
4 years, 9 months ago (2016-03-08 12:46:16 UTC) #39
tommi
4 years, 9 months ago (2016-03-12 01:00:43 UTC) #40
Message was sent while issue was closed.
A revert of this CL (patchset #11 id:250001) has been created in
https://codereview.webrtc.org/1792613002/ by tommi@webrtc.org.

The reason for reverting is: Looks like the Chrome iOS build is broken because
of these two changes.  So I'm going to have to revert.  Here's the error:

https://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_n...

FAILED: rm -f arch/libsafe_numerics.arm64.a && ./gyp-mac-tool filter-libtool
libtool  -static -o arch/libsafe_numerics.arm64.a 
error:
/Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
no files specified
Usage:
/Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]
[-no_warning_for_no_symbols]
Usage:
/Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o
output] [-install_name name] [-compatibility_version #] [-current_version #]
[-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#]
[-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>]
[-all_load] [-noall_load]
FAILED: rm -f arch/libsafe_numerics.armv7.a && ./gyp-mac-tool filter-libtool
libtool  -static -o arch/libsafe_numerics.armv7.a 
error:
/Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
no files specified
Usage:
/Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]
[-no_warning_for_no_symbols]
Usage:
/Applications/Xcode7.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o
output] [-install_name name] [-compatibility_version #] [-current_version #]
[-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#]
[-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>]
[-all_load] [-noall_load]
ninja: build stopped: subcommand failed..

Powered by Google App Engine
This is Rietveld 408576698