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

Unified Diff: webrtc/test/fuzzers/packet_buffer_fuzzer.cc

Issue 2613833003: Don't detect a new frame if a previous packet is used in a previous frame. (Closed)
Patch Set: fuzzer fix. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/test/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/fuzzers/packet_buffer_fuzzer.cc
diff --git a/webrtc/test/fuzzers/packet_buffer_fuzzer.cc b/webrtc/test/fuzzers/packet_buffer_fuzzer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..099fe21fc2ed067f7df0c779069461ae7507ba42
--- /dev/null
+++ b/webrtc/test/fuzzers/packet_buffer_fuzzer.cc
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017 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 "webrtc/modules/video_coding/packet_buffer.h"
+#include "webrtc/system_wrappers/include/clock.h"
+
+namespace webrtc {
+
+namespace {
+class NullCallback : public video_coding::OnReceivedFrameCallback {
+ void OnReceivedFrame(std::unique_ptr<video_coding::RtpFrameObject> frame) {}
+};
+} // namespace
+
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ // Two bytes for the sequence number,
+ // one byte for |is_first_packet_in_frame| and |markerBit|.
+ constexpr size_t kMinDataNeeded = 3;
+ if (size < kMinDataNeeded) {
+ return;
+ }
+
+ VCMPacket packet;
+ NullCallback callback;
+ SimulatedClock clock(0);
+ rtc::scoped_refptr<video_coding::PacketBuffer> packet_buffer(
+ video_coding::PacketBuffer::Create(&clock, 8, 1024, &callback));
+
+ size_t i = kMinDataNeeded;
+ while (i < size) {
+ memcpy(&packet.seqNum, &data[i - kMinDataNeeded], 2);
+ packet.is_first_packet_in_frame = data[i] & 1;
+ packet.markerBit = data[i] & 2;
+ packet_buffer->InsertPacket(&packet);
+ i += kMinDataNeeded;
+ }
+}
+
+} // namespace webrtc
« no previous file with comments | « webrtc/test/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698