mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Fix possible heap-use-after-free in schema inference
This commit is contained in:
parent
8ede5a090f
commit
b666b4e1c9
@ -54,7 +54,7 @@ ColumnsDescription readSchemaFromFormat(
|
||||
ReadBufferIterator & read_buffer_iterator,
|
||||
bool retry,
|
||||
ContextPtr & context,
|
||||
std::unique_ptr<ReadBuffer> & buf_out)
|
||||
std::unique_ptr<ReadBuffer> & buf)
|
||||
{
|
||||
NamesAndTypesList names_and_types;
|
||||
if (FormatFactory::instance().checkIfFormatHasExternalSchemaReader(format_name))
|
||||
@ -73,7 +73,6 @@ ColumnsDescription readSchemaFromFormat(
|
||||
{
|
||||
std::string exception_messages;
|
||||
SchemaReaderPtr schema_reader;
|
||||
std::unique_ptr<ReadBuffer> buf;
|
||||
while ((buf = read_buffer_iterator()))
|
||||
{
|
||||
if (buf->eof())
|
||||
@ -91,7 +90,6 @@ ColumnsDescription readSchemaFromFormat(
|
||||
{
|
||||
schema_reader = FormatFactory::instance().getSchemaReader(format_name, *buf, context, format_settings);
|
||||
names_and_types = schema_reader->readSchema();
|
||||
buf_out = std::move(buf);
|
||||
break;
|
||||
}
|
||||
catch (...)
|
||||
|
Loading…
Reference in New Issue
Block a user