Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Possible panic: nil pointer dereference #5981

Open
ldlb9527 opened this issue Sep 13, 2024 · 1 comment
Open

[Bug]: Possible panic: nil pointer dereference #5981

ldlb9527 opened this issue Sep 13, 2024 · 1 comment
Labels

Comments

@ldlb9527
Copy link

ldlb9527 commented Sep 13, 2024

What happened?

The following code will cause a null pointer exception on the first iteration of the loop if span.TraceID has a zero value.

Steps to reproduce

https://github.com/jaegertracing/jaeger/blob/main/plugin/storage/grpc/shared/grpc_client.go#L193-L209

	var traces []*model.Trace
	var trace *model.Trace
	var traceID model.TraceID
	for received, err := stream.Recv(); !errors.Is(err, io.EOF); received, err = stream.Recv() {
		if err != nil {
			return nil, fmt.Errorf("stream error: %w", err)
		}

		for i, span := range received.Spans {
			if span.TraceID != traceID {
				trace = &model.Trace{}
				traceID = span.TraceID
				traces = append(traces, trace)
			}
			trace.Spans = append(trace.Spans, &received.Spans[i])
		}
	}
@ldlb9527 ldlb9527 added the bug label Sep 13, 2024
@ldlb9527
Copy link
Author

If this is an issue, I’m willing to create a PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant