You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR creates a new OSS-Fuzz fuzzer for JSON processing in the Arrow C++ library, with corpora and dictionary targets. The JSON reader currently has no dedicated fuzz target, so its option space (explicit schemas, unexpected field handling, block sizes, threading, incremental reads) is only exercised indirectly. This is the 1st PR aiming to improve the overall fuzzing coverage and effectiveness of the arrow project, mentioned in #54903.
cpp/src/arrow/json/fuzz.cc (new): the fuzz target. Each input is read with the JSON TableReader (single-threaded and multi-threaded), the streaming StreamingReader, and ParseOne. A small packed header (marker byte) selects the option space explored: block size, threading, newlines_in_values, unexpected_field_behavior, and several explicit-schema variants (including mismatched field names and type coercion). Inputs without the marker byte are read with the default options, so plain-JSON corpora keep working. Each read strategy is given a fresh input stream, as readers consume the stream they are passed. Reader errors on malformed input are tolerated (merged and logged), while validation failures of successful reads are treated as fatal, as a successful read producing invalid Arrow data is a reader bug.
cpp/src/arrow/json/CMakeLists.txt: registers the fuzz target and the corpus generator executable.
cpp/src/arrow/json/generate_fuzz_corpus.cc (new): generates seed corpus files of valid JSON.
cpp/build-support/fuzzing/generate_corpuses.sh: adds the JSON corpus section, guarded so that builds without JSON support skip it instead of failing.
cpp/build-support/fuzzing/dicts/arrow-json-fuzz.dict (new): dictionary of JSON tokens (structural characters, literals, escapes, numeric edge cases) to help the fuzzing engine generate meaningful inputs.
cpp/CMakePresets.json: enables ARROW_JSON in the fuzzing preset so the new target is built by cmake --preset=fuzzing.
Are these changes tested?
Yes on OSS-Fuzz side.
Are there any user-facing changes?
No.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Human
AI
Reviewed before submission by:
Human
AI
Not reviewed
Code and description were drafted with the help of an AI coding agent, then reviewed, revised and validated by the author before submission.
arthurscchan
changed the title
OSS-Fuzz: Add new fuzzer targets json processing
GH-54903: [OSS-Fuzz fuzzing] Add new fuzzer targets json processing
Oct 21, 2026
arthurscchan
changed the title
GH-54903: [OSS-Fuzz fuzzing] Add new fuzzer targets json processing
GH-54903: [C++][OSS-Fuzz fuzzing] Add new fuzzer targets json processing
Oct 22, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Validation failures are silently treated as tolerated parse errors, preventing fuzz findings, and corpus generation unconditionally invokes a JSON executable that the default fuzzing preset does not build.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The threading setting is overwritten, preventing fuzz inputs from exercising the non-threaded streaming decoding path.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Preserve the encoded threading setting for streaming reads
cpp/src/arrow/json/fuzz.cc:137
The threading bit decoded from header[3] has no effect: table reads overwrite it with both fixed values, and this assignment forces streaming reads to use threads. Consequently, no input can exercise the separate non-threaded streaming decoding path in reader.cc. Preserve the encoded setting here so mutations and corpus headers can reach both streaming implementations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
This PR creates a new OSS-Fuzz fuzzer for JSON processing in the Arrow C++ library, with corpora and dictionary targets. The JSON reader currently has no dedicated fuzz target, so its option space (explicit schemas, unexpected field handling, block sizes, threading, incremental reads) is only exercised indirectly. This is the 1st PR aiming to improve the overall fuzzing coverage and effectiveness of the arrow project, mentioned in #54903.
This change is coordinated with the OSS-Fuzz side in google/oss-fuzz#16328.
What changes are included in this PR?
cpp/src/arrow/json/fuzz.cc(new): the fuzz target. Each input is read with the JSONTableReader(single-threaded and multi-threaded), the streamingStreamingReader, andParseOne. A small packed header (marker byte) selects the option space explored: block size, threading,newlines_in_values,unexpected_field_behavior, and several explicit-schema variants (including mismatched field names and type coercion). Inputs without the marker byte are read with the default options, so plain-JSON corpora keep working. Each read strategy is given a fresh input stream, as readers consume the stream they are passed. Reader errors on malformed input are tolerated (merged and logged), while validation failures of successful reads are treated as fatal, as a successful read producing invalid Arrow data is a reader bug.cpp/src/arrow/json/CMakeLists.txt: registers the fuzz target and the corpus generator executable.cpp/src/arrow/json/generate_fuzz_corpus.cc(new): generates seed corpus files of valid JSON.cpp/build-support/fuzzing/generate_corpuses.sh: adds the JSON corpus section, guarded so that builds without JSON support skip it instead of failing.cpp/build-support/fuzzing/dicts/arrow-json-fuzz.dict(new): dictionary of JSON tokens (structural characters, literals, escapes, numeric edge cases) to help the fuzzing engine generate meaningful inputs.cpp/CMakePresets.json: enablesARROW_JSONin thefuzzingpreset so the new target is built bycmake --preset=fuzzing.Are these changes tested?
Yes on OSS-Fuzz side.
Are there any user-facing changes?
No.
Was AI used for this PR?
In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.
PR code and description written by:
Reviewed before submission by:
Code and description were drafted with the help of an AI coding agent, then reviewed, revised and validated by the author before submission.