Run under MSan:

**Describe the bug**
https://clickhouse-test-reports.s3.yandex.net/29341/2b2bec3679df7965af908ce3f1e8e17e39bd12fe/fuzzer_msan/report.html#fail1

**How to reproduce**
```
SELECT number, nth_value(number, '10') OVER w AS secondValue, nth_value(number, 2147483647) OVER w AS thirdValue FROM numbers(1.) WINDOW w AS (ORDER BY number ASC) ORDER BY toInt64(2147483646 - intDiv(number, 2147483647), toInt64(number, NULL - intDiv(number, NULL), 100000002004087730000.)) ASC, number DESC NULLS FIRST
```

```
Changed settings: max_block_size = '1', max_threads = '1', receive_timeout = '10', receive_data_timeout_ms = '10000', max_rows_to_read = '3', engine_file_empty_if_not_exists = '0'
```
if (input.isFinished())
    {
        
        
        assert(!input_is_finished);
        input_is_finished = true;
        return Status::Ready;
    }
    
    input.setNeeded();
    return Status::NeedData;
}
void WindowTransform::work()
{
    
    assert(!input_data.exception);
    assert(has_input || input_is_finished);
    try
    {
        has_input = false;
        appendChunk(input_data.chunk);
    }
    catch (DB::Exception &)
    {
        output_data.exception = std::current_exception();
        has_input = false;
        return;