**Describe the bug**
https://clickhouse-test-reports.s3.yandex.net/19702/c74631c650b42e4d107254a03bd82c2c2913039b/fuzzer_msan/server.log

Most likely introduced here: #11006
{
    if (equal_ranges.empty())
        return;
    if (limit >= size() || limit >= equal_ranges.back().second)
        limit = 0;
    size_t number_of_ranges = equal_ranges.size();
    if (limit)
        --number_of_ranges;
    EqualRanges new_ranges;
    SCOPE_EXIT({equal_ranges = std::move(new_ranges);});
    for (size_t i = 0; i < number_of_ranges; ++i)
    {
        const auto& [first, last] = equal_ranges[i];
        if (reverse)
            std::sort(res.begin() + first, res.begin() + last, less<false>(*this));
        else
            std::sort(res.begin() + first, res.begin() + last, less<true>(*this));