Skip to content

Commit ff499bf

Browse files
authored
decode: opentelemetry: Fix a crash in fluent-bit (#46)
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]>
1 parent 71b31a0 commit ff499bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ctr_decode_opentelemetry.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,9 @@ int ctr_decode_opentelemetry_create(struct ctrace **out_ctr,
571571
ctr_span_kind_set(span, otel_span->kind);
572572
ctr_span_start_ts(ctr, span, otel_span->start_time_unix_nano);
573573
ctr_span_end_ts(ctr, span, otel_span->end_time_unix_nano);
574-
ctr_span_set_status(span, otel_span->status->code, otel_span->status->message);
574+
if (otel_span->status) {
575+
ctr_span_set_status(span, otel_span->status->code, otel_span->status->message);
576+
}
575577
ctr_span_set_attributes(span, otel_span->n_attributes, otel_span->attributes);
576578
ctr_span_set_events(span, otel_span->n_events, otel_span->events);
577579
ctr_span_set_dropped_attributes_count(span, otel_span->dropped_attributes_count);

0 commit comments

Comments
 (0)