From f847909cf2d321ac7d6a8e45f1b3048d5f9fc5d0 Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Tue, 26 May 2020 09:23:26 -0700 Subject: [PATCH] Using ZSTD_MAX_WINDOWLOG instead of INT_MAX --- programs/fileio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/programs/fileio.c b/programs/fileio.c index 46772e18..76243950 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -771,9 +771,10 @@ static void FIO_adjustMemLimitForPatchFromMode(FIO_prefs_t* const prefs, unsigned long long const maxSrcFileSize) { unsigned long long maxSize = MAX(prefs->memLimit, MAX(dictSize, maxSrcFileSize)); + unsigned const maxWindowSize = (1U << ZSTD_WINDOWLOG_MAX); assert(maxSize != UTIL_FILESIZE_UNKNOWN); - if (maxSize > INT_MAX) - EXM_THROW(42, "Can't handle files larger than %u GB\n", INT_MAX/(1 GB) + 1); + if (maxSize > maxWindowSize) + EXM_THROW(42, "Can't handle files larger than %u GB\n", maxWindowSize/(1 GB)); FIO_setMemLimit(prefs, (unsigned)maxSize); }