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 1f91f22b5f
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5087
This commit is contained in:
Aliaksandr Valialkin 2023-10-16 01:55:08 +02:00
parent 2c334ed953
commit 97a7128e4b
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -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,