mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
dbms: Server: feature development. [#METR-15090]
This commit is contained in:
parent
444107f40a
commit
60a3558718
@ -72,7 +72,7 @@ private:
|
||||
int fd = -1;
|
||||
|
||||
Position buffer_begin = nullptr;
|
||||
off_t region_aligned_size = 0;
|
||||
size_t region_aligned_size = 0;
|
||||
|
||||
/// Асинхронная операция чтения ещё не завершилась.
|
||||
bool is_pending_read = false;
|
||||
|
@ -199,6 +199,11 @@ void ReadBufferAIO::prepare()
|
||||
|
||||
/// Регион диска, из которого хотим читать данные.
|
||||
const off_t region_begin = pos_in_file;
|
||||
|
||||
if ((requested_byte_count > std::numeric_limits<off_t>::max()) ||
|
||||
(pos_in_file > (std::numeric_limits<off_t>::max() - static_cast<off_t>(requested_byte_count))))
|
||||
throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
const off_t region_end = pos_in_file + requested_byte_count;
|
||||
|
||||
/// Выровненный регион диска, из которого хотим читать данные.
|
||||
@ -206,6 +211,10 @@ void ReadBufferAIO::prepare()
|
||||
const size_t region_right_padding = (DEFAULT_AIO_FILE_BLOCK_SIZE - (region_end % DEFAULT_AIO_FILE_BLOCK_SIZE)) % DEFAULT_AIO_FILE_BLOCK_SIZE;
|
||||
|
||||
region_aligned_begin = region_begin - region_left_padding;
|
||||
|
||||
if (region_end > (std::numeric_limits<off_t>::max() - static_cast<off_t>(region_right_padding)))
|
||||
throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
const off_t region_aligned_end = region_end + region_right_padding;
|
||||
region_aligned_size = region_aligned_end - region_aligned_begin;
|
||||
|
||||
@ -232,7 +241,7 @@ void ReadBufferAIO::publish()
|
||||
is_eof = true;
|
||||
|
||||
if (pos_in_file > (std::numeric_limits<off_t>::max() - bytes_read))
|
||||
throw Exception("File position overflowed", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception("An overflow occurred during file operation", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
pos_in_file += bytes_read;
|
||||
total_bytes_read += bytes_read;
|
||||
|
Loading…
Reference in New Issue
Block a user