Closed aopat closed 4 years ago
Please answer these questions before submitting a bug report.
0.22.3
go1.14 darwin/amd64
If possible, provide a recipe for reproducing the error.
ochttp.Handler
Propagation: &b3.HTTPFormat{}
1234567812345678aa
Expected the trace/span headers to be considered invalid, so a new trace would be initiated
panic
panic: runtime error: slice bounds out of range [-1:] goroutine 1 [running]: go.opencensus.io/plugin/ochttp/propagation/b3.ParseSpanID(0x132088c, 0x12, 0x0, 0x132088c) /Users/andrew/dev/opencensus-go/plugin/ochttp/propagation/b3/b3.go:98 +0x14e go.opencensus.io/plugin/ochttp/propagation/b3.(*HTTPFormat).SpanContextFromRequest(0x15adcf8, 0xc00022a000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x131d476) /Users/andrew/dev/opencensus-go/plugin/ochttp/propagation/b3/b3.go:53 +0xd9 go.opencensus.io/plugin/ochttp.(*Handler).extractSpanContext(0xc0002dff28, 0xc00022a000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x131f21c) /Users/andrew/dev/opencensus-go/plugin/ochttp/server.go:146 +0x7a go.opencensus.io/plugin/ochttp.(*Handler).startTrace(0xc0002dff28, 0x1389a20, 0xc00013a740, 0xc00022a000, 0x38, 0xc00013a740) /Users/andrew/dev/opencensus-go/plugin/ochttp/server.go:113 +0x133 go.opencensus.io/plugin/ochttp.(*Handler).ServeHTTP(0xc0002dff28, 0x1389a20, 0xc00013a740, 0xc00022a000) /Users/andrew/dev/opencensus-go/plugin/ochttp/server.go:83 +0x9c main.main() /Users/andrew/dev/opencensus-go/tests/invalid-id.go:28 +0x326 exit status 2
This also affects x-b3-traceid headers exceeding 32 characters. span/trace headers need to have an even number of hex characters to produce this issue. Otherwise they correctly fail the hex decoding.
Please answer these questions before submitting a bug report.
What version of OpenCensus are you using?
0.22.3
What version of Go are you using?
go1.14 darwin/amd64
What did you do?
If possible, provide a recipe for reproducing the error.
ochttp.Handler
withPropagation: &b3.HTTPFormat{}
1234567812345678aa
)What did you expect to see?
Expected the trace/span headers to be considered invalid, so a new trace would be initiated
What did you see instead?
panic
Additional context
This also affects x-b3-traceid headers exceeding 32 characters. span/trace headers need to have an even number of hex characters to produce this issue. Otherwise they correctly fail the hex decoding.