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

Issue 1219493004: Prevent size_t underflow in H264 SPS parsing. (Closed)

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

Description

Prevent size_t underflow in H264 SPS parsing. BUG=webrtc:4771 R=stefan@webrtc.org Committed: https://crrev.com/4daa90eed7591f37d7d157f9ec5000d83272a604 Cr-Commit-Position: refs/heads/master@{#9523}

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -2 lines) Patch
M webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc View 1 chunk +2 lines, -2 lines 5 comments Download
M webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc View 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (4 generated)
pbos-webrtc
PTAL
5 years, 5 months ago (2015-06-30 15:29:00 UTC) #1
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1219493004/1
5 years, 5 months ago (2015-06-30 15:29:18 UTC) #3
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 5 months ago (2015-06-30 17:12:04 UTC) #5
stefan-webrtc
lgtm +cc noahric, you may want to know about this bug as it might be ...
5 years, 5 months ago (2015-07-01 09:59:13 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1219493004/1
5 years, 5 months ago (2015-07-01 09:59:20 UTC) #8
commit-bot: I haz the power
Committed patchset #1 (id:1)
5 years, 5 months ago (2015-07-01 10:00:17 UTC) #9
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/4daa90eed7591f37d7d157f9ec5000d83272a604 Cr-Commit-Position: refs/heads/master@{#9523}
5 years, 5 months ago (2015-07-01 10:00:30 UTC) #10
noahric
I think you traded an unlikely bug for an unlikely bug that causes an infinite ...
5 years, 5 months ago (2015-07-01 16:34:39 UTC) #12
pbos-webrtc
On 2015/07/01 16:34:39, noahric wrote: > I think you traded an unlikely bug for an ...
5 years, 5 months ago (2015-07-01 16:47:40 UTC) #13
pbos-webrtc
https://codereview.webrtc.org/1219493004/diff/1/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc File webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc (right): https://codereview.webrtc.org/1219493004/diff/1/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc#newcode39 webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc:39: if (i + 3 < byte_length_ && sps_[i] == ...
5 years, 5 months ago (2015-07-01 18:12:29 UTC) #14
noahric
https://codereview.webrtc.org/1219493004/diff/1/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc File webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc (right): https://codereview.webrtc.org/1219493004/diff/1/webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc#newcode39 webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc:39: if (i + 3 < byte_length_ && sps_[i] == ...
5 years, 5 months ago (2015-07-01 18:49:25 UTC) #15
pbos-webrtc
5 years, 5 months ago (2015-07-02 07:37:50 UTC) #16
Message was sent while issue was closed.
https://codereview.webrtc.org/1219493004/diff/1/webrtc/modules/rtp_rtcp/sourc...
File webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc (right):

https://codereview.webrtc.org/1219493004/diff/1/webrtc/modules/rtp_rtcp/sourc...
webrtc/modules/rtp_rtcp/source/h264_sps_parser.cc:39: if (i + 3 < byte_length_
&& sps_[i] == 0 && sps_[i + 1] == 0 &&
On 2015/07/01 18:49:24, noahric wrote:
> I think the most readable fix is:
> 
> if (byte_length_ - i >= 3 ...
> 
> Meant to be read as: "If there are at least 3 bytes left in the sequence".

Slightly less readable in my opinion, but I won't fight about this one if you
want to push it in.

> Since i is always < byte_length_, that shouldn't underflow, and it'll prevent
> overflow since byte_length_ can't be greater than SIZE_MAX.
> 
> That also fixes an existing bug where a 0 0 3 at the end of the rbsp would get
> skipped. That's not a legal sps anyways, so it'd probably fail for other
reasons
> and give the correct result, but seems sensible to fix it here.

I have no idea what this is or even means. It should only be affected if it's
near SIZE_MAX, correct?

Powered by Google App Engine
This is Rietveld 408576698