opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

[ETW] ETW log exporter possible memory ownership issues

Open marcalff opened this issue 5 months ago • 2 comments

This is not confirmed with testing, only a suspicion raised by code review.

The ostream log exporter has memory ownership issues that can lead to crashes.

See related:

  • #3135
  • #2651
  • #3417
  • #3147

It turns out (seen by code review) that file etw_logger.h uses exactly the same pattern, so it should be subject to the same issues.

  std::unordered_map<std::string, opentelemetry::common::AttributeValue> attributes_map_;
  opentelemetry::common::AttributeValue body_ = opentelemetry::nostd::string_view();

attributes_map_ and body_ can contain stale pointers.

marcalff avatar May 15 '25 21:05 marcalff