]> wimlib.net Git - wimlib/blobdiff - src/xpress_decompress.c
Improve random number generation
[wimlib] / src / xpress_decompress.c
index 623ea187fef32ececc0669afdb247ca51e162726..d6e606cb962df887311488d554e8e0e0b1bdd1ad 100644 (file)
@@ -58,9 +58,9 @@
  *     fail during decompression if the Huffman symbol 256 is not found after
  *     the actual data."
  *
- * This is the case for the implementation in WIMGAPI.  However, wimlib's
- * decompressor in this file currently does not care if this extra symbol is
- * there or not.
+ * This is the case with Microsoft's implementation in WIMGAPI, for example.  So
+ * although our implementation doesn't currently check for this extra symbol,
+ * compressors would be wise to add it.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -82,6 +82,8 @@ struct xpress_decompressor {
                             XPRESS_TABLEBITS, XPRESS_MAX_CODEWORD_LEN);
                u8 lens[XPRESS_NUM_SYMBOLS];
        };
+       DECODE_TABLE_WORKING_SPACE(working_space, XPRESS_NUM_SYMBOLS,
+                                  XPRESS_MAX_CODEWORD_LEN);
 } _aligned_attribute(DECODE_TABLE_ALIGNMENT);
 
 static int
@@ -107,7 +109,8 @@ xpress_decompress(const void *restrict compressed_data, size_t compressed_size,
        /* Build a decoding table for the Huffman code.  */
        if (make_huffman_decode_table(d->decode_table, XPRESS_NUM_SYMBOLS,
                                      XPRESS_TABLEBITS, d->lens,
-                                     XPRESS_MAX_CODEWORD_LEN))
+                                     XPRESS_MAX_CODEWORD_LEN,
+                                     d->working_space))
                return -1;
 
        /* Decode the matches and literals.  */