OLD | NEW |
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/include/ccodec_progressivedecoder.h" | 10 #include "core/fxcodec/codec/ccodec_progressivedecoder.h" |
11 #include "core/fxcodec/include/fx_codec.h" | 11 #include "core/fxcodec/fx_codec.h" |
12 #include "core/fxcrt/fx_stream.h" | 12 #include "core/fxcrt/fx_stream.h" |
13 | 13 |
14 class XFACodecFuzzer { | 14 class XFACodecFuzzer { |
15 public: | 15 public: |
16 static int Fuzz(const uint8_t* data, size_t size, FXCODEC_IMAGE_TYPE type) { | 16 static int Fuzz(const uint8_t* data, size_t size, FXCODEC_IMAGE_TYPE type) { |
17 std::unique_ptr<CCodec_ModuleMgr> mgr(new CCodec_ModuleMgr()); | 17 std::unique_ptr<CCodec_ModuleMgr> mgr(new CCodec_ModuleMgr()); |
18 std::unique_ptr<CCodec_ProgressiveDecoder> decoder( | 18 std::unique_ptr<CCodec_ProgressiveDecoder> decoder( |
19 mgr->CreateProgressiveDecoder()); | 19 mgr->CreateProgressiveDecoder()); |
20 Reader source(data, size); | 20 Reader source(data, size); |
21 | 21 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 FX_FILESIZE GetSize() override { return static_cast<FX_FILESIZE>(m_size); } | 58 FX_FILESIZE GetSize() override { return static_cast<FX_FILESIZE>(m_size); } |
59 | 59 |
60 private: | 60 private: |
61 const uint8_t* const m_data; | 61 const uint8_t* const m_data; |
62 size_t m_size; | 62 size_t m_size; |
63 }; | 63 }; |
64 }; | 64 }; |
65 | 65 |
66 #endif // TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_ | 66 #endif // TESTING_LIBFUZZER_XFA_CODEC_FUZZER_H_ |
OLD | NEW |