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

Side by Side Diff: testing/libfuzzer/pdf_fm2js_fuzzer.cc

Issue 2481933003: Compile fuzzer sources in standalone builds. (try 2) (Closed)
Patch Set: Fix signed comparison issues 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 | « testing/libfuzzer/BUILD.gn ('k') | testing/libfuzzer/pdf_xml_fuzzer.cc » ('j') | 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 #include <cstddef> 5 #include <cstddef>
6 #include <cstdint> 6 #include <cstdint>
7 7
8 #include "core/fxcrt/fx_basic.h" 8 #include "core/fxcrt/fx_basic.h"
9 #include "core/fxcrt/fx_safe_types.h"
9 #include "core/fxcrt/fx_string.h" 10 #include "core/fxcrt/fx_string.h"
10 #include "xfa/fxfa/fm2js/xfa_program.h" 11 #include "xfa/fxfa/fm2js/xfa_program.h"
11 12
12 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 13 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
13 if (size > std::numeric_limits<FX_STRSIZE>::max()) 14 FX_SAFE_STRSIZE safe_size = size;
15 if (!safe_size.IsValid())
14 return 0; 16 return 0;
15 17
16 CFX_WideString input = CFX_WideString::FromUTF8( 18 CFX_WideString input =
17 CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size))); 19 CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
18 CXFA_FMProgram program; 20 CXFA_FMProgram program;
19 if (program.Init(input.AsStringC()) || program.ParseProgram()) 21 if (program.Init(input.AsStringC()) || program.ParseProgram())
20 return 0; 22 return 0;
21 23
22 CFX_WideTextBuf js; 24 CFX_WideTextBuf js;
23 program.TranslateProgram(js); 25 program.TranslateProgram(js);
24 return 0; 26 return 0;
25 } 27 }
OLDNEW
« no previous file with comments | « testing/libfuzzer/BUILD.gn ('k') | testing/libfuzzer/pdf_xml_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698