Jens-G opened a new pull request, #3402:
URL: https://github.com/apache/thrift/pull/3402

   ## Summary
   
   Revive and update the netstd fuzzer infrastructure originally submitted in 
PR #3203 by @mhlakhani. This adds SharpFuzz-based protocol fuzzing for the 
Thrift netstd library, covering all three protocols (Binary, Compact, JSON) 
with both parse and roundtrip fuzzer types, for both AFL and libfuzzer engines.
   
   Key changes on top of the original PR:
   
   - **net10 bump**: Target framework updated from `net9.0` to `net10.0`, 
matching the current Thrift build matrix. The `--gen netstd:net10` flag is used 
for code generation (verified via `t_netstd_generator.cc` — using `net9` would 
actively break the build on net10 targets due to `#if NET10_0_OR_GREATER` 
guards).
   - **SharpFuzz version pin**: `<PackageReference Include="SharpFuzz" 
Version="2.2.0" />` — pinned to a known-good release instead of wildcard `*`.
   - **`DOTNET_ROLL_FORWARD=Major`**: Temporary workaround in both 
`buildfuzzers.sh` and `runfuzzer.sh`. SharpFuzz.CommandLine 2.2.0 pins its 
runtimeconfig to net9.0; this env var allows it to run on a net10-only host. 
Tracked for removal: upstream fix merged as [SharpFuzz PR 
#72](https://github.com/Metalnem/sharpfuzz/pull/72), pending release as 
SharpFuzz 2.3.0.
   - **Opt-in build**: `build-fuzzers` target removed from `check-local` in 
`Makefile.am`. It requires the SharpFuzz.CommandLine global tool and 
libfuzzer-dotnet binary, which are dev-only dependencies not present in CI. Run 
manually with `make build-fuzzers` or `./buildfuzzers.sh`.
   - **`sharpfuzz` CLI preflight**: `buildfuzzers.sh` now checks for the 
`sharpfuzz` command before building 12 assemblies, with actionable install 
instructions on failure.
   - **Exception narrowing**: Catch blocks in `ProtocolFuzzerBase` and 
`ProtocolRoundtripFuzzerBase` narrowed from `catch (Exception)` to specific 
types (`TProtocolException`, `TTransportException`, `TException`, 
`EndOfStreamException`, `IOException`) for improved fuzzer effectiveness.
   - **Path fix**: `FUZZERS_DIR` and related paths in `buildfuzzers.sh` 
resolved via `realpath` so the script works when invoked from the repo root, 
not just from `lib/netstd/`.
   - **Documentation**: README fuzzing section rewritten with exact install 
commands, PATH setup, rollforward workaround explanation, and usage examples.
   
   oss-fuzz integration is out of scope for this PR.
   
   ## Verification
   
   Tested end-to-end inside the `thrift:jammy` docker image:
   - All 12 fuzzer assemblies build successfully (0 warnings, 0 errors)
   - `Thrift.dll` instrumented by SharpFuzz
   - Parse fuzzer (`binary libfuzzer -runs=1000`): 1000 iterations, exit 0
   - `make check` passes without SharpFuzz on PATH (89 tests, 0 failures)
   
   ## JIRA
   
   [THRIFT-5855](https://issues.apache.org/jira/browse/THRIFT-5855)
   
   ---
   
   Co-Authored-By: Hasnain Lakhani <[email protected]>
   Generated-by: Claude Opus 4.6


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to