Skip to content

OSS-Fuzz: Add new fuzzer targets compression - #3678

Open
arthurscchan wants to merge 2 commits into
apache:masterfrom
arthurscchan:brpc-compress-fuzzer
Open

arthurscchan wants to merge 2 commits into
apache:masterfrom
arthurscchan:brpc-compress-fuzzer

Conversation

@arthurscchan

Copy link
Copy Markdown
Contributor

This PR creates a new OSS-Fuzz fuzzer targets compression for improving the overall fuzzing coverage and effectiveness of project brpc.

@wwbmmm
wwbmmm requested a lite review from Copilot November 12, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

5 open issues
What changed in this PR

Adds a new OSS-Fuzz target to exercise brpc compression/decompression code paths and integrates it into the fuzz build lists.

Changes:

  • Add fuzz_compress libFuzzer target focusing on gzip/zlib/snappy compression policies.
  • Include fuzz_compress in the local fuzz CMake target list.
  • Include fuzz_compress in the OSS-Fuzz build script target list.
File Description
test/​fuzzing/​oss-fuzz.sh Builds the new fuzz_compress target for OSS-Fuzz.
test/​fuzzing/​fuzz_compress.cpp New fuzzer that exercises gzip/zlib/snappy compress/decompress paths.
test/​CMakeLists.txt Registers fuzz_compress in FUZZ_TARGETS so it’s built with other fuzzers.

Review effort: Lite

Comment on lines +18 to +21
// Fuzz brpc's compression policies on the wire direction that servers are
// attacked through: fuzz bytes are compressed with gzip/zlib (both window
// styles) or snappy, and arbitrary fuzz bytes are also fed straight into the
// decompressors (the hostile-compressed-payload model).
#include "butil/iobuf.h"
#include "brpc/policy/gzip_compress.h"
#include "brpc/policy/snappy_compress.h"

Comment on lines +39 to +41
brpc::policy::GzipCompressOptions opts;
brpc::policy::GzipCompressOptions zlib_opts;
zlib_opts.format = google::protobuf::io::GzipOutputStream::ZLIB;
// hostile compressed payload: feed the raw fuzz bytes to every
// decompressor
brpc::policy::GzipDecompress(in, &out);
out.clear();
Comment on lines +29 to +33
if (size < 5) {
return 0;
}

const uint8_t mode = data[0] % 5;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants