mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00

git ls-files | grep -e "\(\.h\|\.cc\)$" | grep -vE "^(rtc_base|sdk|modules|api|call|common_audio|examples|media|net|p2p|pc)/" | xargs clang-format -i ; git cl format after landing: add to .git-blame-ignore-revs Bug: webrtc:15082 Change-Id: I9c7fc4e6fbb023809fb22a89a78be713de6990d3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/302063 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/main@{#39978}
38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2019 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 <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include <vector>
|
|
|
|
#include "api/array_view.h"
|
|
#include "modules/rtp_rtcp/source/video_rtp_depacketizer_av1.h"
|
|
#include "test/fuzzers/fuzz_data_helper.h"
|
|
|
|
namespace webrtc {
|
|
void FuzzOneInput(const uint8_t* data, size_t size) {
|
|
std::vector<rtc::ArrayView<const uint8_t>> rtp_payloads;
|
|
|
|
// Convert plain array of bytes into array of array bytes.
|
|
test::FuzzDataHelper fuzz_input(rtc::MakeArrayView(data, size));
|
|
while (fuzz_input.CanReadBytes(sizeof(uint16_t))) {
|
|
// In practice one rtp payload can be up to ~1200 - 1500 bytes. Majority
|
|
// of the payload is just copied. To make fuzzing more efficient limit the
|
|
// size of rtp payload to realistic value.
|
|
uint16_t next_size = fuzz_input.Read<uint16_t>() % 1200;
|
|
if (next_size > fuzz_input.BytesLeft()) {
|
|
next_size = fuzz_input.BytesLeft();
|
|
}
|
|
rtp_payloads.push_back(fuzz_input.ReadByteArray(next_size));
|
|
}
|
|
// Run code under test.
|
|
VideoRtpDepacketizerAv1().AssembleFrame(rtp_payloads);
|
|
}
|
|
} // namespace webrtc
|