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
3 // found in the LICENSE file.
4 
5 #include <memory>
6 
7 #include "core/fxcrt/cfx_memorystream.h"
8 #include "core/fxcrt/cfx_seekablestreamproxy.h"
9 #include "core/fxcrt/retain_ptr.h"
10 #include "core/fxcrt/xml/cfx_saxreader.h"
11 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)12 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
13   CFX_SAXReader reader;
14   if (reader.StartParse(pdfium::MakeRetain<CFX_MemoryStream>(
15                             const_cast<uint8_t*>(data), size, false),
16                         0, -1, CFX_SaxParseMode_NotSkipSpace) < 0) {
17     return 0;
18   }
19 
20   while (1) {
21     int32_t ret = reader.ContinueParse();
22     if (ret < 0 || ret > 99)
23       break;
24   }
25 
26   return 0;
27 }
28