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

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: Fix cast, fuzzers. 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
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
17 void DoAddEventLogString(const std::string& event) {} 17 void DoAddEventLogString(const std::string& event) {}
18 18
19 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {} 19 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {}
20 20
21 protected: 21 protected:
22 virtual ~NullMediaLog() {} 22 virtual ~NullMediaLog() {}
23 23
24 private: 24 private:
25 DISALLOW_COPY_AND_ASSIGN(NullMediaLog); 25 DISALLOW_COPY_AND_ASSIGN(NullMediaLog);
26 }; 26 };
27 27
28 // Entry point for LibFuzzer. 28 // Entry point for LibFuzzer.
29 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 29 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
30 bool err; 30 bool err;
31 scoped_refptr<NullMediaLog> media_log(new NullMediaLog()); 31 NullMediaLog media_log;
32 std::unique_ptr<media::mp4::BoxReader> reader( 32 std::unique_ptr<media::mp4::BoxReader> reader(
33 media::mp4::BoxReader::ReadTopLevelBox(data, static_cast<const int>(size), 33 media::mp4::BoxReader::ReadTopLevelBox(data, static_cast<const int>(size),
34 media_log, &err)); 34 &media_log, &err));
35 if (err) { 35 if (err) {
36 return 0; 36 return 0;
37 } 37 }
38 if (reader == NULL) { 38 if (reader == NULL) {
39 return 0; 39 return 0;
40 } 40 }
41 if (!reader->ScanChildren()) { 41 if (!reader->ScanChildren()) {
42 return 0; 42 return 0;
43 } 43 }
44 return 0; 44 return 0;
45 } 45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698