Description
bridges/otellogr recursively converts logged map, slice, array, pointer, and interface values without cycle detection or a maximum depth. Current-tree validation showed Info, Error, and WithValues route key/value pairs through convertKVs, which calls convertValue recursively.
Steps To Reproduce
05-64319f7dcd008191b710dfa7316b5c8b-recursive-log-conversion-can-crash-on-cyclic-data.zip
- Use
go.opentelemetry.io/contrib/bridges/otellogr.
- Create a cyclic value such as
m := map[string]any{}; m["self"] = m.
- Log the value through
otellogr.LogSink.Info, Error, or WithValues, or run the PoC test from the artifact zip.
- Observe unbounded recursion that can lead to stack exhaustion or process crash.
Expected behavior
Recursive log value conversion should detect cycles or enforce a maximum depth so cyclic or extremely deep values cannot crash the process.
Description
bridges/otellogrrecursively converts logged map, slice, array, pointer, and interface values without cycle detection or a maximum depth. Current-tree validation showedInfo,Error, andWithValuesroute key/value pairs throughconvertKVs, which callsconvertValuerecursively.Steps To Reproduce
05-64319f7dcd008191b710dfa7316b5c8b-recursive-log-conversion-can-crash-on-cyclic-data.zip
go.opentelemetry.io/contrib/bridges/otellogr.m := map[string]any{}; m["self"] = m.otellogr.LogSink.Info,Error, orWithValues, or run the PoC test from the artifact zip.Expected behavior
Recursive log value conversion should detect cycles or enforce a maximum depth so cyclic or extremely deep values cannot crash the process.