Fuzzer for FEC header readers.
BUG=webrtc:5654 Review-Url: https://codereview.webrtc.org/2265493002 Cr-Commit-Position: refs/heads/master@{#14470}
This commit is contained in:
parent
0496de298e
commit
cada34cd98
@ -69,6 +69,24 @@ webrtc_fuzzer_test("vp8_qp_parser_fuzzer") {
|
||||
]
|
||||
}
|
||||
|
||||
webrtc_fuzzer_test("flexfec_header_reader_fuzzer") {
|
||||
sources = [
|
||||
"flexfec_header_reader_fuzzer.cc",
|
||||
]
|
||||
deps = [
|
||||
"../../modules/rtp_rtcp/",
|
||||
]
|
||||
}
|
||||
|
||||
webrtc_fuzzer_test("ulpfec_header_reader_fuzzer") {
|
||||
sources = [
|
||||
"ulpfec_header_reader_fuzzer.cc",
|
||||
]
|
||||
deps = [
|
||||
"../../modules/rtp_rtcp/",
|
||||
]
|
||||
}
|
||||
|
||||
webrtc_fuzzer_test("producer_fec_fuzzer") {
|
||||
sources = [
|
||||
"producer_fec_fuzzer.cc",
|
||||
|
||||
34
webrtc/test/fuzzers/flexfec_header_reader_fuzzer.cc
Normal file
34
webrtc/test/fuzzers/flexfec_header_reader_fuzzer.cc
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/base/scoped_ref_ptr.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/flexfec_header_reader_writer.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
using Packet = ForwardErrorCorrection::Packet;
|
||||
|
||||
void FuzzOneInput(const uint8_t* data, size_t size) {
|
||||
ForwardErrorCorrection::ReceivedFecPacket packet;
|
||||
packet.pkt = rtc::scoped_refptr<Packet>(new Packet());
|
||||
const size_t packet_size =
|
||||
std::min(size, static_cast<size_t>(IP_PACKET_SIZE));
|
||||
memcpy(packet.pkt->data, data, packet_size);
|
||||
packet.pkt->length = packet_size;
|
||||
|
||||
FlexfecHeaderReader flexfec_reader;
|
||||
flexfec_reader.ReadFecHeader(&packet);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
34
webrtc/test/fuzzers/ulpfec_header_reader_fuzzer.cc
Normal file
34
webrtc/test/fuzzers/ulpfec_header_reader_fuzzer.cc
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/base/scoped_ref_ptr.h"
|
||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/ulpfec_header_reader_writer.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
using Packet = ForwardErrorCorrection::Packet;
|
||||
|
||||
void FuzzOneInput(const uint8_t* data, size_t size) {
|
||||
ForwardErrorCorrection::ReceivedFecPacket packet;
|
||||
packet.pkt = rtc::scoped_refptr<Packet>(new Packet());
|
||||
const size_t packet_size =
|
||||
std::min(size, static_cast<size_t>(IP_PACKET_SIZE));
|
||||
memcpy(packet.pkt->data, data, packet_size);
|
||||
packet.pkt->length = packet_size;
|
||||
|
||||
UlpfecHeaderReader ulpfec_reader;
|
||||
ulpfec_reader.ReadFecHeader(&packet);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
Loading…
x
Reference in New Issue
Block a user