From 4278b00a6689aef4b7a015e00f4d5a7c33f871eb Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 16 Oct 2023 01:55:08 +0200 Subject: [PATCH] app/vmselect/promql: do not use unsafe conversion from bytes slice to string when storing a value by map key The assigned map key shouldn't change over time, otherwise the map won't work properly. This is a follow-up for 1f91f22b5f0c93be6c65983834fcea8ccebc6594 Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5087 --- app/vmselect/promql/transform.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 25ff45fbe8..65a06971da 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -420,7 +420,7 @@ func transformBucketsLimit(tfa *transformFuncArg) ([]*timeseries, error) { mn.CopyFrom(&ts.MetricName) mn.RemoveTag("le") b = marshalMetricNameSorted(b[:0], &mn) - k := bytesutil.ToUnsafeString(b) + k := string(b) m[k] = append(m[k], x{ le: le, ts: ts,