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

Side by Side Diff: testing/libfuzzer/fuzzers/mp4_box_reader_fuzzer.cc

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 | « testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 8 #include <memory>
9 9
10 #include "base/logging.h"
10 #include "media/formats/mp4/box_reader.h" 11 #include "media/formats/mp4/box_reader.h"
11 #include "base/logging.h"
12 12
13 class NullMediaLog : public media::MediaLog { 13 class NullMediaLog : public media::MediaLog {
14 public: 14 public:
15 NullMediaLog() {} 15 NullMediaLog() {}
16 16 ~NullMediaLog() override {}
17 void DoAddEventLogString(const std::string& event) {}
18 17
19 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {} 18 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {}
20 19
21 protected:
22 virtual ~NullMediaLog() {}
23
24 private: 20 private:
25 DISALLOW_COPY_AND_ASSIGN(NullMediaLog); 21 DISALLOW_COPY_AND_ASSIGN(NullMediaLog);
26 }; 22 };
27 23
28 // Entry point for LibFuzzer. 24 // Entry point for LibFuzzer.
29 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 25 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
30 bool err; 26 bool err;
31 scoped_refptr<NullMediaLog> media_log(new NullMediaLog()); 27 NullMediaLog media_log;
32 std::unique_ptr<media::mp4::BoxReader> reader( 28 std::unique_ptr<media::mp4::BoxReader> reader(
33 media::mp4::BoxReader::ReadTopLevelBox(data, static_cast<const int>(size), 29 media::mp4::BoxReader::ReadTopLevelBox(data, static_cast<int>(size),
34 media_log, &err)); 30 &media_log, &err));
35 if (err) { 31 return !err && reader && reader->ScanChildren() ? 0 : 0;
36 return 0;
37 }
38 if (reader == NULL) {
39 return 0;
40 }
41 if (!reader->ScanChildren()) {
42 return 0;
43 }
44 return 0;
45 } 32 }
OLDNEW
« no previous file with comments | « testing/libfuzzer/fuzzers/es_parser_mpeg1audio_fuzzer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698