Repository navigation
GH-54903: [C++][OSS-Fuzz fuzzing] Add new fuzzer targets arrow compute process - #54904
Open
arthurscchan wants to merge 1 commit into
Open
arthurscchan wants to merge 1 commit into
arthurscchan wants to merge 1 commit into
Conversation
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 with corpora and dictionary targets for the Arrow compute function layer. The compute kernels (arithmetic, vector and aggregate functions) currently have no dedicated fuzz target, so their behaviour on unusual but valid inputs is only exercised indirectly. This is the 2nd 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#16330.
What changes are included in this PR?
cpp/src/arrow/compute/fuzz.cc(new): the fuzz target. Each input is parsed as an Arrow IPC stream, and each decoded record batch is validated. A small 8-byte packed header (marker byte) selects which compute function to evaluate on the decoded batches — unary scalar functions (abs,negate,floor,ceil,sqrt), vector functions (unique,value_counts,dictionary_encode), aggregate functions (sum,mean,min_max,approximate_median,count) and binary scalar functions (add,subtract,multiply,divide,power,max,min) — together with an argument mode (first column only, column plus scalar, or two columns). Kernels are allowed to reject inputs with a non-OK status; crashes and memory errors are the interesting findings. Inputs without the marker byte are treated as plain IPC streams and only validated, which keeps the existing IPC corpus useful and continues to fuzz the IPC reader itself.cpp/src/arrow/compute/CMakeLists.txt: registers the fuzz target and the corpus generator executable.cpp/src/arrow/compute/generate_fuzz_corpus.cc(new): generates seed corpus files - small valid IPC streams (int64/float64 batches with nulls and negatives, UTF-8 string batches including empty and non-ASCII values, small int batches), each prefixed with the fuzz header so the seeds reach the kernels directly.cpp/build-support/fuzzing/generate_corpuses.sh: adds the compute corpus section.cpp/build-support/fuzzing/dicts/arrow-compute-fuzz.dict(new): dictionary of Arrow IPC stream framing tokens (stream magic and common flatbuffer scaffolding) to help the fuzzing engine construct well-formed IPC streams that reach the kernels.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.