1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-12 10:04:29 +02:00
opentelemetry-go/api
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
..
core Add comments and test for 64-bit field alignment (#418) 2020-01-06 13:08:40 -05:00
correlation Move correlation context propagation to correlation package (#479) 2020-02-20 10:31:21 -08:00
global Fix a possible nil-dereference crash (#478) 2020-02-20 13:05:19 -08:00
key Namespace import path under "/otel" (#274) 2019-11-01 11:40:29 -07:00
metric Update metric types to not use pointer receivers (#462) 2020-02-04 10:27:03 -08:00
propagation Refactor propagators (#467) 2020-02-13 23:16:04 -08:00
testharness Replace span relationship with a potentially remote parent context (#451) 2020-02-04 08:55:03 -08:00
trace Move correlation context propagation to correlation package (#479) 2020-02-20 10:31:21 -08:00
unit Namespace import path under "/otel" (#274) 2019-11-01 11:40:29 -07:00