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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_format_h264_unittest.cc

Issue 1218013002: Prevent OOB reads for zero-length H264 payloads. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 payload = RtpDepacketizer::ParsedPayload(); 531 payload = RtpDepacketizer::ParsedPayload();
532 ASSERT_TRUE(depacketizer_->Parse(&payload, packet3, sizeof(packet3))); 532 ASSERT_TRUE(depacketizer_->Parse(&payload, packet3, sizeof(packet3)));
533 ExpectPacket(&payload, kExpected3, sizeof(kExpected3)); 533 ExpectPacket(&payload, kExpected3, sizeof(kExpected3));
534 EXPECT_EQ(kVideoFrameKey, payload.frame_type); 534 EXPECT_EQ(kVideoFrameKey, payload.frame_type);
535 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec); 535 EXPECT_EQ(kRtpVideoH264, payload.type.Video.codec);
536 EXPECT_FALSE(payload.type.Video.isFirstPacket); 536 EXPECT_FALSE(payload.type.Video.isFirstPacket);
537 EXPECT_EQ(kH264FuA, payload.type.Video.codecHeader.H264.packetization_type); 537 EXPECT_EQ(kH264FuA, payload.type.Video.codecHeader.H264.packetization_type);
538 EXPECT_EQ(kIdr, payload.type.Video.codecHeader.H264.nalu_type); 538 EXPECT_EQ(kIdr, payload.type.Video.codecHeader.H264.nalu_type);
539 } 539 }
540
541 TEST_F(RtpDepacketizerH264Test, TestEmptyPayload) {
stefan-webrtc 2015/06/30 10:20:03 Seems like we may want to have a few generic tests
pbos-webrtc 2015/06/30 11:22:05 No, since they are different formats the only thin
542 // Using a wild pointer to crash on accesses from inside the depacketizer.
543 uint8_t* garbage_ptr = reinterpret_cast<uint8_t*>(0x4711);
544 RtpDepacketizer::ParsedPayload payload;
545 EXPECT_FALSE(depacketizer_->Parse(&payload, garbage_ptr, 0));
546 }
547
540 } // namespace webrtc 548 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_format_h264.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698