Merge pull request #51260 from ClickHouse/urlfree

Fix use-after-free in StorageURL when switching URLs
This commit is contained in:
Alexey Milovidov 2023-06-23 08:13:35 +03:00 committed by GitHub
commit 9945118dbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 0 deletions

View File

@ -153,6 +153,7 @@ public:
/// * Parallel reading.
/// To enable it, make sure `buf` is a SeekableReadBuffer implementing readBigAt().
/// * Parallel parsing.
/// `buf` must outlive the returned IInputFormat.
InputFormatPtr getInput(
const String & name,
ReadBuffer & buf,

View File

@ -361,6 +361,8 @@ Chunk StorageURLSource::generate()
pipeline->reset();
reader.reset();
input_format.reset();
read_buf.reset();
}
return {};
}

View File

@ -0,0 +1,5 @@
136
136
136
136
136

View File

@ -0,0 +1,5 @@
select sum(*) from (select * from url('http://127.0.0.1:8123?query=select+{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}+as+x+format+TSV', 'TSV') settings max_threads=1, max_download_threads=1);
select sum(*) from (select * from url('http://127.0.0.1:8123?query=select+{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}+as+x+format+CSV', 'CSV') settings max_threads=1, max_download_threads=1);
select sum(*) from (select * from url('http://127.0.0.1:8123?query=select+{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}+as+x+format+JSONEachRow', 'JSONEachRow') settings max_threads=1, max_download_threads=1);
select sum(*) from (select * from url('http://127.0.0.1:8123?query=select+{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}+as+x+format+TSKV', 'TSKV') settings max_threads=1, max_download_threads=1);
select sum(*) from (select * from url('http://127.0.0.1:8123?query=select+{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}+as+x+format+Native', 'Native') settings max_threads=1, max_download_threads=1);