1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-14 10:13:10 +02:00
opentelemetry-go/api/global/internal
Krzesimir Nowak 29cd0c08b7
Fix a possible nil-dereference crash (#478)
* Test for a panic inside global internal meter instrument's Unbind

* Fix a possible nil-dereference crash

There is a nil dereference crash if we perform some operations in
certain order:

- get a global meter
- create an instrument
- bind it
- set the delegate
- unbind the instrument
- call some recording function on the not-really-bound-anymore
  instrument

Unbind will run the no op run-once initialization routine, so the
follow-up RecordOne call will not run it's initialization
routine. Which RecordOne's initialization routine being skipped, the
delegate to bounded instrument is not set, but the code is still
trying to get a pointer to it and then unconditionally dereference it.

Add an extra check for a nil pointer - if this is true, then Unbind
was first and RecordOne should effectively be a no op.

Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
2020-02-20 13:05:19 -08:00
..
benchmark_test.go Global trace forwarding implementation (#406) 2020-01-02 16:20:38 -05:00
meter_test.go Fix a possible nil-dereference crash (#478) 2020-02-20 13:05:19 -08:00
meter.go Fix a possible nil-dereference crash (#478) 2020-02-20 13:05:19 -08:00
state.go Global trace forwarding implementation (#406) 2020-01-02 16:20:38 -05:00
trace_test.go Remove Tracer name prefix for Span names (#430) 2020-01-14 04:54:48 -08:00
trace.go Add StartOptions to Tracer.WithSpan() (#472) 2020-02-10 21:07:32 -05:00