| 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 #include <cstddef> | 5 #include <cstddef> |
| 6 #include <cstdint> | 6 #include <cstdint> |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "core/fxcrt/fx_basic.h" | 9 #include "core/fxcrt/fx_basic.h" |
| 10 #include "core/fxcrt/fx_safe_types.h" | 10 #include "core/fxcrt/fx_safe_types.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 48 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 49 FX_SAFE_STRSIZE safe_size = size; | 49 FX_SAFE_STRSIZE safe_size = size; |
| 50 if (!safe_size.IsValid()) | 50 if (!safe_size.IsValid()) |
| 51 return 0; | 51 return 0; |
| 52 | 52 |
| 53 CFX_WideString input = | 53 CFX_WideString input = |
| 54 CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie())); | 54 CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie())); |
| 55 std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> stream( | 55 std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream( |
| 56 new CXFA_WideTextRead(input)); | 56 new CXFA_WideTextRead(input)); |
| 57 if (!stream) | 57 if (!stream) |
| 58 return 0; | 58 return 0; |
| 59 | 59 |
| 60 std::unique_ptr<CFDE_XMLDoc> doc = pdfium::MakeUnique<CFDE_XMLDoc>(); | 60 std::unique_ptr<CFDE_XMLDoc> doc = pdfium::MakeUnique<CFDE_XMLDoc>(); |
| 61 std::unique_ptr<CFDE_XMLParser, ReleaseDeleter<CFDE_XMLParser>> parser( | 61 std::unique_ptr<CFDE_XMLParser, ReleaseDeleter<CFDE_XMLParser>> parser( |
| 62 new CXFA_XMLParser(doc->GetRoot(), stream.get())); | 62 new CXFA_XMLParser(doc->GetRoot(), stream.get())); |
| 63 | 63 |
| 64 if (!doc->LoadXML(parser.release())) | 64 if (!doc->LoadXML(parser.release())) |
| 65 return 0; | 65 return 0; |
| 66 | 66 |
| 67 int32_t load_result = doc->DoLoad(nullptr); | 67 int32_t load_result = doc->DoLoad(nullptr); |
| 68 if (load_result < 100) | 68 if (load_result < 100) |
| 69 return 0; | 69 return 0; |
| 70 | 70 |
| 71 (void)XFA_FDEExtension_GetDocumentNode(doc.get()); | 71 (void)XFA_FDEExtension_GetDocumentNode(doc.get()); |
| 72 return 0; | 72 return 0; |
| 73 } | 73 } |
| OLD | NEW |