mirror of
https://github.com/facebook/zstd.git
synced 2025-12-10 00:06:51 -05:00
Merge pull request #3345 from daniellerozenblit/fix-1GiB-file-bug
Fix Window Resizing Edge Case
This commit is contained in:
commit
b0bcbbfe16
@ -1370,8 +1370,8 @@ ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* resize windowLog if input is small enough, to use less memory */
|
/* resize windowLog if input is small enough, to use less memory */
|
||||||
if ( (srcSize < maxWindowResize)
|
if ( (srcSize <= maxWindowResize)
|
||||||
&& (dictSize < maxWindowResize) ) {
|
&& (dictSize <= maxWindowResize) ) {
|
||||||
U32 const tSize = (U32)(srcSize + dictSize);
|
U32 const tSize = (U32)(srcSize + dictSize);
|
||||||
static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN;
|
static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN;
|
||||||
U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN :
|
U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN :
|
||||||
|
|||||||
9
tests/cli-tests/compression/window-resize.sh
Executable file
9
tests/cli-tests/compression/window-resize.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
datagen -g1G > file
|
||||||
|
zstd --long=31 -1 --single-thread --no-content-size -f file
|
||||||
|
zstd -l -v file.zst
|
||||||
|
|
||||||
|
# We want to ignore stderr (its outputting "*** zstd command line interface
|
||||||
|
# 64-bits v1.5.3, by Yann Collet ***")
|
||||||
|
|
||||||
|
rm file file.zst
|
||||||
3
tests/cli-tests/compression/window-resize.sh.stdout.glob
Normal file
3
tests/cli-tests/compression/window-resize.sh.stdout.glob
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
...
|
||||||
|
Window Size: 1.000 GiB (1073741824 B)
|
||||||
|
...
|
||||||
Loading…
x
Reference in New Issue
Block a user