Add fuzzing of VP8 QP parsing.

BUG=webrtc:4771
R=asapersson@webrtc.org, kjellander@webrtc.org

Review URL: https://codereview.webrtc.org/1469123004 .

Cr-Commit-Position: refs/heads/master@{#10806}
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index f2767e0..d968dd2 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -284,6 +284,7 @@
   group("webrtc_fuzzers") {
     testonly = true
     deps = [
+      "test/fuzzers:vp8_qp_parser_fuzzer",
       "test/fuzzers:vp9_depacketizer_fuzzer",
     ]
   }
diff --git a/webrtc/test/fuzzers/BUILD.gn b/webrtc/test/fuzzers/BUILD.gn
index 96e09ec..4cf6a5c 100644
--- a/webrtc/test/fuzzers/BUILD.gn
+++ b/webrtc/test/fuzzers/BUILD.gn
@@ -15,6 +15,7 @@
   ]
   deps = [
     "../../system_wrappers:field_trial_default",
+    "../../system_wrappers:metrics_default",
     "//testing/libfuzzer:libfuzzer_main",
   ]
 }
@@ -33,3 +34,19 @@
     configs -= [ "//build/config/clang:find_bad_constructs" ]
   }
 }
+
+test("vp8_qp_parser_fuzzer") {
+  sources = [
+    "vp8_qp_parser_fuzzer.cc",
+  ]
+  deps = [
+    ":webrtc_fuzzer_main",
+    "../../modules/video_coding/",
+  ]
+
+  if (is_clang) {
+    # Suppress warnings from Chrome's Clang plugins.
+    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+    configs -= [ "//build/config/clang:find_bad_constructs" ]
+  }
+}
diff --git a/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc b/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc
new file mode 100644
index 0000000..5135f1a
--- /dev/null
+++ b/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc
@@ -0,0 +1,17 @@
+/*
+ *  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 "webrtc/modules/video_coding/utility/vp8_header_parser.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+  int qp;
+  vp8::GetQp(data, size, &qp);
+}
+}  // namespace webrtc