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

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

Issue 1855823002: convert //testing to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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>
9
8 #include "media/formats/mp4/box_reader.h" 10 #include "media/formats/mp4/box_reader.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 12
12 class NullMediaLog : public media::MediaLog { 13 class NullMediaLog : public media::MediaLog {
13 public: 14 public:
14 NullMediaLog() {} 15 NullMediaLog() {}
15 16
16 void DoAddEventLogString(const std::string& event) {} 17 void DoAddEventLogString(const std::string& event) {}
17 18
18 void AddEvent(scoped_ptr<media::MediaLogEvent> event) override {} 19 void AddEvent(std::unique_ptr<media::MediaLogEvent> event) override {}
19 20
20 protected: 21 protected:
21 virtual ~NullMediaLog() {} 22 virtual ~NullMediaLog() {}
22 23
23 private: 24 private:
24 DISALLOW_COPY_AND_ASSIGN(NullMediaLog); 25 DISALLOW_COPY_AND_ASSIGN(NullMediaLog);
25 }; 26 };
26 27
27 // Entry point for LibFuzzer. 28 // Entry point for LibFuzzer.
28 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 29 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
29 bool err; 30 bool err;
30 scoped_refptr<NullMediaLog> media_log(new NullMediaLog()); 31 scoped_refptr<NullMediaLog> media_log(new NullMediaLog());
31 scoped_ptr<media::mp4::BoxReader> reader( 32 std::unique_ptr<media::mp4::BoxReader> reader(
32 media::mp4::BoxReader::ReadTopLevelBox(data, 33 media::mp4::BoxReader::ReadTopLevelBox(data, static_cast<const int>(size),
33 static_cast<const int>(size), 34 media_log, &err));
34 media_log,
35 &err));
36 if (err) { 35 if (err) {
37 return 0; 36 return 0;
38 } 37 }
39 if (reader == NULL) { 38 if (reader == NULL) {
40 return 0; 39 return 0;
41 } 40 }
42 if (!reader->ScanChildren()) { 41 if (!reader->ScanChildren()) {
43 return 0; 42 return 0;
44 } 43 }
45 return 0; 44 return 0;
46 } 45 }
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