Skip to content

Add native Go fuzz drivers to enable OSS-Fuzz integration #622

Description

@xingyaner

Describe the bug
The go-ldap project is integrated with OSS-Fuzz, but the repository currently ships no fuzzer entry points. OSS-Fuzz's compile_native_go_fuzzer requires Fuzz* functions with the func FuzzXxx(f *testing.F) signature to exist inside the target package; without them, the OSS-Fuzz build cannot produce any fuzzer binaries for this project.

To Reproduce
Build the project via OSS-Fuzz :
python3 infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 go-ldap
The build fails because the functions do not exist in the package:
Could not find the function: func FuzzParseDN(f *testing.F)

Expected behavior
The build succeeds and produces the fuzzer binaries fuzz_parse_dn, fuzz_decode_escaped_symbols and fuzz_escape_dn. Additionally, the same Fuzz* functions can be run locally with Go's native fuzzing: go test -fuzz=FuzzParseDN ./v3.

Code snippets
If applicable, add code snippets to help explain your problem.

Additional context

  • The three functions cover the DN parsing and escaping logic in v3/dn.go (ParseDN, decodeString, encodeString).
  • This change goes together with a change to the OSS-Fuzz project config (projects/go-ldap/build.sh), which will be updated in the oss-fuzz repository to run the build inside the v3 module (cd v3 && go get ...) and point the fuzzer targets at the /v3 package path. Both sides are required for the OSS-Fuzz build of go-ldap to succeed.
  • check_build already passes with these drivers.
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions