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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/libfuzzer/BUILD.gn ('k') | testing/libfuzzer/pdf_xml_fuzzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/pdf_fm2js_fuzzer.cc
diff --git a/testing/libfuzzer/pdf_fm2js_fuzzer.cc b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
index 3e3bfae0d462d5992a1c1c4e25ada4e920d398a5..ced5e183994ed8def3406b3269dfc0d0d2980be1 100644
--- a/testing/libfuzzer/pdf_fm2js_fuzzer.cc
+++ b/testing/libfuzzer/pdf_fm2js_fuzzer.cc
@@ -6,15 +6,17 @@
#include <cstdint>
#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/fm2js/xfa_program.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- if (size > std::numeric_limits<FX_STRSIZE>::max())
+ FX_SAFE_STRSIZE safe_size = size;
+ if (!safe_size.IsValid())
return 0;
- CFX_WideString input = CFX_WideString::FromUTF8(
- CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
+ CFX_WideString input =
+ CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
CXFA_FMProgram program;
if (program.Init(input.AsStringC()) || program.ParseProgram())
return 0;
« 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