Skip to content

opentelemetry-go: add new fuzz tests and change fuzzer naming pattern#14250

Merged
AdamKorcz merged 5 commits intogoogle:masterfrom
pellared:otel-add-fuzz-tests
Nov 5, 2025
Merged

opentelemetry-go: add new fuzz tests and change fuzzer naming pattern#14250
AdamKorcz merged 5 commits intogoogle:masterfrom
pellared:otel-add-fuzz-tests

Conversation

@pellared
Copy link
Copy Markdown
Contributor

@pellared pellared commented Nov 5, 2025

This PR add new fuzzers and renames fuzzer binaries in the OpenTelemetry Go projects to include the module path as a prefix, improving clarity and avoiding name collisions.

Changes

projects/opentelemetry-go/build.sh

  • Added 3 new fuzzers: FuzzHashKVs, FuzzTraceIDFromHex, and FuzzSpanIDFromHex
  • Renamed fuzzer binaries to include module prefixes:
    • FuzzHashKVssdk_attribute_FuzzHashKVs
    • FuzzGetBinsdk_metric_internal_aggregate_FuzzGetBin
    • FuzzTraceIDFromHextrace_FuzzTraceIDFromHex
    • FuzzSpanIDFromHextrace_FuzzSpanIDFromHex

projects/opentelemetry-go-contrib/build.sh

  • Added new fuzzer: FuzzYAMLWithEnvVars
  • Renamed fuzzer binaries to include module and version prefixes:
    • FuzzJSONotelconf_v0.3.0_FuzzJSON
    • FuzzYAMLotelconf_v0.3.0_FuzzYAML
    • FuzzYAMLWithEnvVarsotelconf_v0.3.0_FuzzYAMLWithEnvVars

Benefits

  • Clearer naming: Fuzzer binary names now indicate which module they test
  • Avoid collisions: Prevents potential name conflicts when multiple modules have fuzzers with the same function name

@pellared pellared changed the title renamer the fuzzers to be built rename the fuzzers to be built Nov 5, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 5, 2025

pellared has previously contributed to projects/opentelemetry-go-contrib. The previous PR was #14234
pellared has previously contributed to projects/opentelemetry-go. The previous PR was #13062

@pellared pellared changed the title rename the fuzzers to be built opentelemetry-go: add new fuzz tests Nov 5, 2025
@pellared pellared changed the title opentelemetry-go: add new fuzz tests opentelemetry-go: add new fuzz tests and change fuzzer naming pattern Nov 5, 2025
Comment on lines +21 to +23
# Mitigate the error: found packages attribute_test and attribute in /src/opentelemetry-go/attribute.
# Remove all Go files with *_test package before building the fuzzer.
grep -rl --include="*.go" '^package .*_test' . | xargs rm -f
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without this I got (from https://github.com/google/oss-fuzz/actions/runs/19094642663/job/54551813623):

Running go  [build -buildmode c-archive -tags gofuzz_libfuzzer,libfuzzer,gofuzz -trimpath -gcflags all=-d=libfuzzer -gcflags syscall=-d=libfuzzer=0 -gcflags runtime/cgo=-d=libfuzzer=0 -gcflags runtime/pprof=-d=libfuzzer=0 -overlay /tmp/gofuzzbuild1941669612/ossFuzzOverlayFile.json1224461702 -o sdk_attribute_FuzzHashKVs.a ./main.346016195.go]
main.346016195.go:12:2: found packages attribute_test (benchmark_libFuzzer.go) and attribute (doc.go) in /src/opentelemetry-go/attribute
panic: exit status 1

goroutine 1 [running]:
main.main()
	/tmp/go-118-fuzz-build/main.go:196 +0x140e
ERROR:__main__:Building fuzzers failed.

Copy link
Copy Markdown
Contributor Author

@pellared pellared Nov 5, 2025

Choose a reason for hiding this comment

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

There is already an issue that is related to this problem:

CC @AdamKorcz

@pellared pellared marked this pull request as ready for review November 5, 2025 07:53
@pellared
Copy link
Copy Markdown
Contributor Author

pellared commented Nov 5, 2025

@dashpole, @dmathieu: PTAL

@AdamKorcz AdamKorcz merged commit 9afe5cd into google:master Nov 5, 2025
17 checks passed
@pellared pellared deleted the otel-add-fuzz-tests branch November 5, 2025 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants