Skip to content

Commit ffe1872

Browse files
authored
Merge pull request #60203 from ClickHouse/limit_libarchive_format
Limit libarchive format to what we use
2 parents c93a222 + b6771d0 commit ffe1872

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

src/IO/Archives/LibArchiveReader.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,17 @@ class LibArchiveReader::Handle
152152
auto * archive = archive_read_new();
153153
try
154154
{
155-
archive_read_support_filter_all(archive);
156-
archive_read_support_format_all(archive);
155+
// Support for bzip2, gzip, lzip, xz, zstd and lz4
156+
archive_read_support_filter_bzip2(archive);
157+
archive_read_support_filter_gzip(archive);
158+
archive_read_support_filter_xz(archive);
159+
archive_read_support_filter_lz4(archive);
160+
archive_read_support_filter_zstd(archive);
161+
// Support tar, 7zip and zip
162+
archive_read_support_format_tar(archive);
163+
archive_read_support_format_7zip(archive);
164+
archive_read_support_format_zip(archive);
165+
157166
if (archive_read_open_filename(archive, path_to_archive.c_str(), 10240) != ARCHIVE_OK)
158167
throw Exception(ErrorCodes::CANNOT_UNPACK_ARCHIVE, "Couldn't open archive {}: {}", quoteString(path_to_archive), archive_error_string(archive));
159168
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
1
2+
4
3+
1
4+
4
5+
1
6+
4
7+
1
8+
4
9+
1
10+
4
11+
1
12+
4
13+
Unrecognized archive format
14+
Unrecognized archive format

0 commit comments

Comments
 (0)