From: Peter Pentchev Date: Wed, 22 Dec 2021 15:05:53 +0000 (+0200) Subject: Raise the lzip max dictionary size to 512MB. X-Git-Tag: v3.6.0~27^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1645%2Fhead;p=thirdparty%2Flibarchive.git Raise the lzip max dictionary size to 512MB. The lzip documentation specifies that the logarithm of the dictionary base size may be in the range 12-29, and the lzip utility is quite capable of creating an archive with a dictionary larger than 128M if passed the appropriate -s command-line option. --- diff --git a/libarchive/archive_read_support_filter_xz.c b/libarchive/archive_read_support_filter_xz.c index 11807cf67..25a65edef 100644 --- a/libarchive/archive_read_support_filter_xz.c +++ b/libarchive/archive_read_support_filter_xz.c @@ -293,8 +293,8 @@ lzma_bidder_bid(struct archive_read_filter_bidder *self, /* Second through fifth bytes are dictionary size, stored in * little-endian order. The minimum dictionary size is * 1 << 12(4KiB) which the lzma of LZMA SDK uses with option - * -d12 and the maximum dictionary size is 1 << 27(128MiB) - * which the one uses with option -d27. + * -d12 and the maximum dictionary size is 1 << 29(512MiB) + * which the one uses with option -d29. * NOTE: A comment of LZMA SDK source code says this dictionary * range is from 1 << 12 to 1 << 30. */ dicsize = archive_le32dec(buffer+1); @@ -377,7 +377,7 @@ lzip_has_member(struct archive_read_filter *filter) /* Dictionary size. */ log2dic = buffer[5] & 0x1f; - if (log2dic < 12 || log2dic > 27) + if (log2dic < 12 || log2dic > 29) return (0); bits_checked += 8; @@ -562,7 +562,7 @@ lzip_init(struct archive_read_filter *self) /* Get dictionary size. */ log2dic = h[5] & 0x1f; - if (log2dic < 12 || log2dic > 27) + if (log2dic < 12 || log2dic > 29) return (ARCHIVE_FATAL); dicsize = 1U << log2dic; if (log2dic > 12) diff --git a/libarchive/archive_write_add_filter_xz.c b/libarchive/archive_write_add_filter_xz.c index 9dd2c30e5..04bee90ef 100644 --- a/libarchive/archive_write_add_filter_xz.c +++ b/libarchive/archive_write_add_filter_xz.c @@ -251,13 +251,13 @@ archive_compressor_xz_init_stream(struct archive_write_filter *f, int ds, log2dic, wedges; /* Calculate a coded dictionary size */ - if (dict_size < (1 << 12) || dict_size > (1 << 27)) { + if (dict_size < (1 << 12) || dict_size > (1 << 29)) { archive_set_error(f->archive, ARCHIVE_ERRNO_MISC, "Unacceptable dictionary size for lzip: %d", dict_size); return (ARCHIVE_FATAL); } - for (log2dic = 27; log2dic >= 12; log2dic--) { + for (log2dic = 29; log2dic >= 12; log2dic--) { if (dict_size & (1 << log2dic)) break; }