From 474d9fbf357e8853e5862a9c7c2a02c76212e6cb Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Tue, 11 Feb 2025 17:00:52 +0100 Subject: [PATCH] pathbuilder: it's not safe to reuse memory Signed-off-by: Vicent Marti --- go/vt/sqlparser/pathbuilder/builder.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/go/vt/sqlparser/pathbuilder/builder.go b/go/vt/sqlparser/pathbuilder/builder.go index e13c3bb38c9..321c1d217e7 100644 --- a/go/vt/sqlparser/pathbuilder/builder.go +++ b/go/vt/sqlparser/pathbuilder/builder.go @@ -18,7 +18,6 @@ package pathbuilder import ( "encoding/binary" - "unsafe" ) // ASTPathBuilder is used to build @@ -39,7 +38,7 @@ func NewASTPathBuilder() *ASTPathBuilder { // ToPath returns the current path as a string of the used bytes. func (apb *ASTPathBuilder) ToPath() string { - return unsafe.String(unsafe.SliceData(apb.path), len(apb.path)) + return string(apb.path) } // AddStep appends a single step (2 bytes) to path.