mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #47540 from Avogar/fix-bson-bug
Fix BSONEachRow parallel parsing when document size is invalid
This commit is contained in:
commit
ffa8af2861
@ -999,6 +999,9 @@ fileSegmentationEngineBSONEachRow(ReadBuffer & in, DB::Memory<> & memory, size_t
|
|||||||
"the value setting 'min_chunk_bytes_for_parallel_parsing' or check your data manually, most likely BSON is malformed",
|
"the value setting 'min_chunk_bytes_for_parallel_parsing' or check your data manually, most likely BSON is malformed",
|
||||||
min_bytes, document_size);
|
min_bytes, document_size);
|
||||||
|
|
||||||
|
if (document_size < sizeof(document_size))
|
||||||
|
throw ParsingException(ErrorCodes::INCORRECT_DATA, "Size of BSON document is invalid");
|
||||||
|
|
||||||
size_t old_size = memory.size();
|
size_t old_size = memory.size();
|
||||||
memory.resize(old_size + document_size);
|
memory.resize(old_size + document_size);
|
||||||
memcpy(memory.data() + old_size, reinterpret_cast<char *>(&document_size), sizeof(document_size));
|
memcpy(memory.data() + old_size, reinterpret_cast<char *>(&document_size), sizeof(document_size));
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
set input_format_parallel_parsing=1;
|
||||||
|
select * from format(BSONEachRow, 'x UInt32', x'00000000'); -- {serverError INCORRECT_DATA}
|
Loading…
Reference in New Issue
Block a user