dd-trace-go icon indicating copy to clipboard operation
dd-trace-go copied to clipboard

[BUG]: Fuzz function FuzzComposeTracestate - Inconsistent composing/parsing

Open edznux-dd opened this issue 7 months ago • 0 comments

Tracer Version(s)

HEAD (f92a95e4313dda76ac10592731652e282e9fd66b)

Go Version(s)

go version go1.23.5 linux/amd64

Bug Report

Running the already existing fuzz test causes a test failure for FuzzParseTraceparent here.

This specific test failure is cause by a symbol (like ~) character in the value of the provided that is then converted to a _ instead.

Note: I believe these fuzz tests are not run regularly part of CI. But as we will soon start to run these frequently internally, it'd be nice to get this fixed

Reproduction Code

Simply running the fuzzer should reproduce very quickly

cd ddtrace/tracer
go test -fuzz FuzzComposeTracestate -run FuzzComposeTracestate

If the fuzzer can't find find the issue, or if you want to run it as a regression directly, you can add a item in its testCases with the following values:

{priority: 1,
k1: "0", v1: "0",
k2: "0", v2: "=",
k3: "1", v3: "0",
oldState: "0"},

Causes the FuzzComposeTracestate fuzz function to fail.

Error Logs

pre compose: (map["_dd.p.0":"~" "_dd.p.1":"0" "tracestate":"dd=s:1;p:0000000000000000;t.0:_;t.1:0,0"])
is different from
parsed: (map["_dd.p.0":"_" "_dd.p.1":"0" "tracestate":"dd=s:1;p:0000000000000000;t.0:_;t.1:0,0"])
for tracestate of: (dd=s:1;p:0000000000000000;t.0:_;t.1:0,0)

Go Env Output

No response

edznux-dd avatar Jun 12 '25 09:06 edznux-dd