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

Unified Diff: media/filters/vp9_parser_fuzzertest.cc

Issue 1770583002: Add fuzzer test for various media parsers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add base dependency Created 4 years, 9 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 | « media/filters/vp8_parser_fuzzertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/vp9_parser_fuzzertest.cc
diff --git a/media/filters/vp9_parser_fuzzertest.cc b/media/filters/vp9_parser_fuzzertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9ea0164ff9b0b5391601749033ba246fee542cd5
--- /dev/null
+++ b/media/filters/vp9_parser_fuzzertest.cc
@@ -0,0 +1,34 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base/numerics/safe_conversions.h"
+#include "media/filters/ivf_parser.h"
+#include "media/filters/vp9_parser.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ const uint8_t* ivf_payload = nullptr;
+ media::IvfParser ivf_parser;
+ media::IvfFileHeader ivf_file_header;
+ media::IvfFrameHeader ivf_frame_header;
+
+ if (!ivf_parser.Initialize(data, size, &ivf_file_header))
+ return 0;
+
+ // Parse until the end of stream/unsupported stream/error in stream is found.
+ while (ivf_parser.ParseNextFrame(&ivf_frame_header, &ivf_payload)) {
+ media::Vp9Parser vp9_parser;
+ media::Vp9FrameHeader vp9_frame_header;
+ vp9_parser.SetStream(ivf_payload, ivf_frame_header.frame_size);
+ while (vp9_parser.ParseNextFrame(&vp9_frame_header) ==
+ media::Vp9Parser::kOk) {
+ // Repeat until all frames processed.
+ }
+ }
+
+ return 0;
+}
« no previous file with comments | « media/filters/vp8_parser_fuzzertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698