From 072b962b81775604cf8297b782f87bf3b2802109 Mon Sep 17 00:00:00 2001 From: Ray <104485059+973212983@users.noreply.github.com> Date: Mon, 17 Nov 2025 15:21:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E2=80=8Eencoding/gjson):=20fix=20gjson=20d?= =?UTF-8?q?ata=20race=20(#4510)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- encoding/gjson/gjson_api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/encoding/gjson/gjson_api.go b/encoding/gjson/gjson_api.go index 63c75ee28..f00c9e3c8 100644 --- a/encoding/gjson/gjson_api.go +++ b/encoding/gjson/gjson_api.go @@ -142,6 +142,8 @@ func (j *Json) Contains(pattern string) bool { // The target value by `pattern` should be type of slice or map. // It returns -1 if the target value is not found, or its type is invalid. func (j *Json) Len(pattern string) int { + j.mu.RLock() + defer j.mu.RUnlock() p := j.getPointerByPattern(pattern) if p != nil { switch (*p).(type) {