]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Raise the lzip max dictionary size to 512MB. 1645/head
authorPeter Pentchev <roam@debian.org>
Wed, 22 Dec 2021 15:05:53 +0000 (17:05 +0200)
committerPeter Pentchev <roam@debian.org>
Wed, 22 Dec 2021 15:05:53 +0000 (17:05 +0200)
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.

libarchive/archive_read_support_filter_xz.c
libarchive/archive_write_add_filter_xz.c

index 11807cf6768bb5c6e2c2b1189adc4ff804232afe..25a65edef178bb491c725b9d0dc1909de10b340d 100644 (file)
@@ -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)
index 9dd2c30e5de7a1cba73a5bc47d4f960f8a0d2de8..04bee90efa46130cef253056cbe0dac4156002ff 100644 (file)
@@ -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;
                }