From f0bf59564292dd4d4a4fb8980c9518d20789e78a Mon Sep 17 00:00:00 2001 From: Axisflow Date: Wed, 19 Aug 2026 16:20:28 +0800 Subject: [PATCH] Fix nil pointer dereference when a failing sub-status has no message TSStatus.Message is optional in the Thrift IDL, so a failing sub-status can arrive without one. verifySuccesses dereferenced it unconditionally: if status.Code != SuccessStatus && status.Code != RedirectionRecommend { buff.WriteString(*status.Message + ";") } so a MULTIPLE_ERROR whose sub-statuses carry only codes panics inside the client, on a response the server is allowed to send. VerifySuccess already guards the envelope message a few lines below, which is what makes the missing guard here look like an oversight rather than an assumption. Fall back to the status code when no message is supplied, so the returned BatchError still identifies which sub-status failed. --- client/utils.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/utils.go b/client/utils.go index 276cbe4..e96d2d7 100644 --- a/client/utils.go +++ b/client/utils.go @@ -244,7 +244,12 @@ func verifySuccesses(statuses []*common.TSStatus) error { buff := bytes.Buffer{} for _, status := range statuses { if status.Code != SuccessStatus && status.Code != RedirectionRecommend { - buff.WriteString(*status.Message + ";") + if status.Message != nil { + buff.WriteString(*status.Message) + buff.WriteString(";") + } else { + fmt.Fprintf(&buff, "error code: %d;", status.Code) + } } } errMsg := buff.String()