Fix UB in LimitReadBuffer in case of unexpected EOF

Fixes the following possible assertions:
- ./src/IO/ReadBuffer.h:58: bool DB::ReadBuffer::next(): Assertion `!hasPendingData()' failed.
- ./src/IO/LimitReadBuffer.cpp:17: virtual bool DB::LimitReadBuffer::nextImpl(): Assertion `position() >= in->position()' failed.

Fixes: 02151_http_s_structure_set_eof
This commit is contained in:
Azat Khuzhin 2021-12-19 23:37:12 +03:00
parent 08ced87880
commit 4230f04f72

View File

@ -29,7 +29,8 @@ bool LimitReadBuffer::nextImpl()
if (!in->next())
{
working_buffer = in->buffer();
/// Clearing the buffer with existing data.
set(in->position(), 0);
return false;
}