Skip to content

Commit

Permalink
decode: opentelemetry: Fix a crash in fluent-bit
Browse files Browse the repository at this point in the history
This patch fixes a crash in fluent-bit when ctr_decode_opentelemetry_create()
tries to access the span status and when that span status is not present.

the patch has been tested with opentelemetry-cpp-1.12.0/example_otlp_http
http://localhost:4318/v1/traces DEBUG=yes bin and fluent-bit 2.2.0

Signed-off-by: Srinivasan J <[email protected]>
  • Loading branch information
srini38 committed Dec 3, 2023
1 parent 71b31a0 commit 1cf251a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ctr_decode_opentelemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,9 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr,
ctr_span_kind_set(span, otel_span->kind);
ctr_span_start_ts(ctr, span, otel_span->start_time_unix_nano);
ctr_span_end_ts(ctr, span, otel_span->end_time_unix_nano);
ctr_span_set_status(span, otel_span->status->code, otel_span->status->message);
if (otel_span->status) {
ctr_span_set_status(span, otel_span->status->code, otel_span->status->message);
}
ctr_span_set_attributes(span, otel_span->n_attributes, otel_span->attributes);
ctr_span_set_events(span, otel_span->n_events, otel_span->events);
ctr_span_set_dropped_attributes_count(span, otel_span->dropped_attributes_count);
Expand Down

0 comments on commit 1cf251a

Please sign in to comment.