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

Side by Side Diff: testing/libfuzzer/xfa_codec_fuzzer.h

Issue 2452523005: Fix libfuzzer build broken at 9f7f7f8 (Closed)
Patch Set: Created 4 years, 1 month 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 PDFium Authors. All rights reserved. 1 // Copyright 2016 The PDFium 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 #ifndef TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_ 5 #ifndef TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_
6 #define TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_ 6 #define TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "core/fxcodec/codec/ccodec_progressivedecoder.h" 10 #include "core/fxcodec/codec/ccodec_progressivedecoder.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 private: 43 private:
44 class Reader : public IFX_SeekableReadStream { 44 class Reader : public IFX_SeekableReadStream {
45 public: 45 public:
46 Reader(const uint8_t* data, size_t size) : m_data(data), m_size(size) {} 46 Reader(const uint8_t* data, size_t size) : m_data(data), m_size(size) {}
47 ~Reader() {} 47 ~Reader() {}
48 48
49 void Release() override {} 49 void Release() override {}
50 50
51 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { 51 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
52 if (offset < 0 || offset >= m_size) 52 if (offset < 0 || offset >= m_size)
53 return FALSE; 53 return false;
54 if (offset + size > m_size) 54 if (offset + size > m_size)
55 size = m_size - offset; 55 size = m_size - offset;
56 if (size == 0) 56 if (size == 0)
57 return FALSE; 57 return false;
58 58
59 memcpy(buffer, m_data + offset, size); 59 memcpy(buffer, m_data + offset, size);
60 return TRUE; 60 return true;
61 } 61 }
62 62
63 FX_FILESIZE GetSize() override { return static_cast<FX_FILESIZE>(m_size); } 63 FX_FILESIZE GetSize() override { return static_cast<FX_FILESIZE>(m_size); }
64 64
65 private: 65 private:
66 const uint8_t* const m_data; 66 const uint8_t* const m_data;
67 size_t m_size; 67 size_t m_size;
68 }; 68 };
69 }; 69 };
70 70
71 #endif // TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_ 71 #endif // TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_
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