Fix RtpFrameReferenceFinderFuzzer to not generate invalid input

Make sure that the packets in the packet buffer belonging to the
first and last sequence numbers are marked as first and last,
respectively.

Bug: chromium:989856
Change-Id: I57bdd7d62d585be2d2083a6b5ce67fce89ab4389
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147875
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28769}
This commit is contained in:
Johannes Kron
2019-08-05 12:31:38 +02:00
committed by Commit Bot
parent c89468a4b7
commit 10da4a0025

View File

@ -123,9 +123,16 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
video_coding::RtpFrameReferenceFinder reference_finder(&cb);
while (reader.MoreToRead()) {
// Make sure that these packets fulfill the contract of RtpFrameObject.
uint16_t first_seq_num = reader.GetNum<uint16_t>();
uint16_t last_seq_num = reader.GetNum<uint16_t>();
VCMPacket* first_packet = pb->GetPacket(first_seq_num);
VCMPacket* last_packet = pb->GetPacket(last_seq_num);
first_packet->video_header.is_first_packet_in_frame = true;
last_packet->video_header.is_last_packet_in_frame = true;
auto frame = absl::make_unique<video_coding::RtpFrameObject>(
pb, reader.GetNum<uint16_t>(), reader.GetNum<uint16_t>(), 0, 0, 0, 0,
RtpPacketInfos());
pb, first_seq_num, last_seq_num, 0, 0, 0, 0, RtpPacketInfos());
reference_finder.ManageFrame(std::move(frame));
}
}