Skip to content

Commit c27efd5

Browse files
committed
fix: copy entries slice before in-place reversal in ZRANGE
The legacy blob path returns the unmarshalled struct Entries slice directly. Reversing it in-place could mutate shared backing memory. Clone the slice before calling reverseZSetEntries.
1 parent 010467e commit c27efd5

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

adapter/redis_compat_commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,7 @@ func (r *RedisServer) zrangeRead(conn redcon.Conn, key []byte, start, stop int,
16291629
return
16301630
}
16311631
if opts.reverse {
1632+
entries = append([]redisZSetEntry(nil), entries...)
16321633
reverseZSetEntries(entries)
16331634
}
16341635
s, e := normalizeRankRange(start, stop, len(entries))

0 commit comments

Comments
 (0)