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

Side by Side Diff: media/filters/vp9_parser_fuzzertest.cc

Issue 2640973003: Disable logging in media_vp9_parser_fuzzer. (Closed)
Patch Set: Add a comment 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "media/filters/ivf_parser.h" 9 #include "media/filters/ivf_parser.h"
10 #include "media/filters/vp9_parser.h" 10 #include "media/filters/vp9_parser.h"
11 11
12 struct Environment {
13 Environment() {
14 // Disable noisy logging as per "libFuzzer in Chrome" documentation:
15 // testing/libfuzzer/getting_started.md#Disable-noisy-error-message-logging.
16 logging::SetMinLogLevel(logging::LOG_FATAL);
17 }
18 };
19
20 Environment* env = new Environment();
21
12 // Entry point for LibFuzzer. 22 // Entry point for LibFuzzer.
13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 23 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
14 const uint8_t* ivf_payload = nullptr; 24 const uint8_t* ivf_payload = nullptr;
15 media::IvfParser ivf_parser; 25 media::IvfParser ivf_parser;
16 media::IvfFileHeader ivf_file_header; 26 media::IvfFileHeader ivf_file_header;
17 media::IvfFrameHeader ivf_frame_header; 27 media::IvfFrameHeader ivf_frame_header;
18 28
19 if (!ivf_parser.Initialize(data, size, &ivf_file_header)) 29 if (!ivf_parser.Initialize(data, size, &ivf_file_header))
20 return 0; 30 return 0;
21 31
22 // Parse until the end of stream/unsupported stream/error in stream is found. 32 // Parse until the end of stream/unsupported stream/error in stream is found.
23 while (ivf_parser.ParseNextFrame(&ivf_frame_header, &ivf_payload)) { 33 while (ivf_parser.ParseNextFrame(&ivf_frame_header, &ivf_payload)) {
24 // TODO(kcwu): fuzzing with parsing_compressed_header=true. 34 // TODO(kcwu): fuzzing with parsing_compressed_header=true.
25 media::Vp9Parser vp9_parser(false); 35 media::Vp9Parser vp9_parser(false);
26 media::Vp9FrameHeader vp9_frame_header; 36 media::Vp9FrameHeader vp9_frame_header;
27 vp9_parser.SetStream(ivf_payload, ivf_frame_header.frame_size); 37 vp9_parser.SetStream(ivf_payload, ivf_frame_header.frame_size);
28 while (vp9_parser.ParseNextFrame(&vp9_frame_header) == 38 while (vp9_parser.ParseNextFrame(&vp9_frame_header) ==
29 media::Vp9Parser::kOk) { 39 media::Vp9Parser::kOk) {
30 // Repeat until all frames processed. 40 // Repeat until all frames processed.
31 } 41 }
32 } 42 }
33 43
34 return 0; 44 return 0;
35 } 45 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698