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

Issue 1226993003: Refactor byte_io to avoid potentially undefined behavior (Closed)

Created:
5 years, 5 months ago by sprang_webrtc
Modified:
5 years, 3 months ago
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, mflodman
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Make sure ByteReader and ByteWriter classes (and their specializations) don't perform operations that have implementation-specific or undefined behavior. Pitfalls: * Left shift of signed integer has undefined behavior * Right-shift of signed integer has platform-specific behavior is value is negative * Cast from unsigned to signed has undefined behavior if value is negative BUG=webrtc:4824 Committed: https://crrev.com/be9b7b6881e5b0e0b54e7d2fb79c5af5f68c015b Cr-Commit-Position: refs/heads/master@{#9854}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Added comment #

Patch Set 3 : Added static assert #

Patch Set 4 : Larger refactoring to avoid unsafe signed bit ops #

Patch Set 5 : Additional comment #

Patch Set 6 : Simplified int to uint cast #

Patch Set 7 : Fixed definition of signed bit mask constants #

Patch Set 8 : Changed mask again, to plain literal #

Patch Set 9 : Use ll suffix for 64bit singed integers #

Patch Set 10 : Use l suffix for 32bit signed integer literals (win) #

Patch Set 11 : Damn these integer literals #

Patch Set 12 : Removed TypeVerifier util #

Patch Set 13 : Simplified UnsignedOf #

Patch Set 14 : Please don't be like that, msvc2013 :( #

Patch Set 15 : Use numeric limits to get signed min-val #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+205 lines, -39 lines) Patch
M webrtc/modules/rtp_rtcp/source/byte_io.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +205 lines, -39 lines 2 comments Download

Messages

Total messages: 19 (4 generated)
sprang_webrtc
5 years, 5 months ago (2015-07-08 11:01:28 UTC) #2
stefan-webrtc
https://codereview.webrtc.org/1226993003/diff/1/webrtc/modules/rtp_rtcp/source/byte_io.h File webrtc/modules/rtp_rtcp/source/byte_io.h (right): https://codereview.webrtc.org/1226993003/diff/1/webrtc/modules/rtp_rtcp/source/byte_io.h#newcode92 webrtc/modules/rtp_rtcp/source/byte_io.h:92: return ~used_bits_mask | val; I think this deserves a ...
5 years, 5 months ago (2015-07-08 12:01:50 UTC) #3
sprang_webrtc
Addressed comment: Added comment. https://codereview.webrtc.org/1226993003/diff/1/webrtc/modules/rtp_rtcp/source/byte_io.h File webrtc/modules/rtp_rtcp/source/byte_io.h (right): https://codereview.webrtc.org/1226993003/diff/1/webrtc/modules/rtp_rtcp/source/byte_io.h#newcode92 webrtc/modules/rtp_rtcp/source/byte_io.h:92: return ~used_bits_mask | val; On ...
5 years, 5 months ago (2015-07-08 12:57:03 UTC) #4
stefan-webrtc
lgtm
5 years, 5 months ago (2015-07-08 13:29:10 UTC) #5
sprang_webrtc
I did further refactoring of this in order to remove any and all instances where ...
5 years, 5 months ago (2015-07-10 15:23:03 UTC) #6
pbos-webrtc
5 years, 4 months ago (2015-07-27 14:11:16 UTC) #8
pbos-webrtc
As discussed offline make a simpler check for two's complement and assume that if one ...
5 years, 4 months ago (2015-07-27 14:31:19 UTC) #9
sprang_webrtc
5 years, 4 months ago (2015-07-28 09:59:26 UTC) #10
stefan-webrtc
Is this CL pending review or action? Seems like it would be good to get ...
5 years, 3 months ago (2015-09-01 12:24:51 UTC) #11
sprang_webrtc
Please review.
5 years, 3 months ago (2015-09-02 12:49:30 UTC) #12
pbos-webrtc
lgtm https://codereview.webrtc.org/1226993003/diff/270001/webrtc/modules/rtp_rtcp/source/byte_io.h File webrtc/modules/rtp_rtcp/source/byte_io.h (right): https://codereview.webrtc.org/1226993003/diff/270001/webrtc/modules/rtp_rtcp/source/byte_io.h#newcode247 webrtc/modules/rtp_rtcp/source/byte_io.h:247: // TODO(sprang): Check if these actually help or ...
5 years, 3 months ago (2015-09-03 15:18:08 UTC) #13
sprang_webrtc
https://codereview.webrtc.org/1226993003/diff/270001/webrtc/modules/rtp_rtcp/source/byte_io.h File webrtc/modules/rtp_rtcp/source/byte_io.h (right): https://codereview.webrtc.org/1226993003/diff/270001/webrtc/modules/rtp_rtcp/source/byte_io.h#newcode247 webrtc/modules/rtp_rtcp/source/byte_io.h:247: // TODO(sprang): Check if these actually help or if ...
5 years, 3 months ago (2015-09-04 07:24:06 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1226993003/270001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1226993003/270001
5 years, 3 months ago (2015-09-04 07:24:19 UTC) #17
commit-bot: I haz the power
Committed patchset #15 (id:270001)
5 years, 3 months ago (2015-09-04 08:07:01 UTC) #18
commit-bot: I haz the power
5 years, 3 months ago (2015-09-04 08:07:12 UTC) #19
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/be9b7b6881e5b0e0b54e7d2fb79c5af5f68c015b
Cr-Commit-Position: refs/heads/master@{#9854}

Powered by Google App Engine
This is Rietveld 408576698