From e38be1a1fcaa0b303ac45f937628057344f54fd7 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Mon, 24 Jan 2022 18:02:05 -0800 Subject: [PATCH] value.Walk: fix data race Acquire a read lock when walking through a CUE value. Fixes #1494 Signed-off-by: Andrea Luzzardi --- compiler/value.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/value.go b/compiler/value.go index 5e59bf40..cd8cb6c5 100644 --- a/compiler/value.go +++ b/compiler/value.go @@ -185,7 +185,10 @@ func (v *Value) IsConcreteR(opts ...cue.Option) error { } func (v *Value) Walk(before func(*Value) bool, after func(*Value)) { - // FIXME: lock? + // FIXME: this is a long lock + v.cc.rlock() + defer v.cc.runlock() + var ( llBefore func(cue.Value) bool llAfter func(cue.Value)