diff --git a/Fix-buffer-underflow-for-null-dir1.patch b/Fix-buffer-underflow-for-null-dir1.patch deleted file mode 100644 index ac837261f294fdb112eeb8d6017fdb037912e05b..0000000000000000000000000000000000000000 --- a/Fix-buffer-underflow-for-null-dir1.patch +++ /dev/null @@ -1,66 +0,0 @@ -From e1873ad576cb478fff0e6e44ad99599cd5fd2846 Mon Sep 17 00:00:00 2001 -From: Elliot Gorokhovsky -Date: Fri, 29 Jul 2022 11:10:47 -0700 -Subject: [PATCH] Fix buffer underflow for null dir1 - ---- - programs/util.c | 38 +++++++++++++++++++------------------- - 1 file changed, 19 insertions(+), 19 deletions(-) - -diff --git a/programs/util.c b/programs/util.c -index f53eb03f..b874344c 100644 ---- a/programs/util.c -+++ b/programs/util.c -@@ -870,30 +870,30 @@ static const char * trimPath(const char *pathname) - - static char* mallocAndJoin2Dir(const char *dir1, const char *dir2) - { -- const size_t dir1Size = strlen(dir1); -- const size_t dir2Size = strlen(dir2); -- char *outDirBuffer, *buffer, trailingChar; -- - assert(dir1 != NULL && dir2 != NULL); -- outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); -- CONTROL(outDirBuffer != NULL); -+ { const size_t dir1Size = strlen(dir1); -+ const size_t dir2Size = strlen(dir2); -+ char *outDirBuffer, *buffer; - -- memcpy(outDirBuffer, dir1, dir1Size); -- outDirBuffer[dir1Size] = '\0'; -+ outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); -+ CONTROL(outDirBuffer != NULL); - -- if (dir2[0] == '.') -- return outDirBuffer; -+ memcpy(outDirBuffer, dir1, dir1Size); -+ outDirBuffer[dir1Size] = '\0'; - -- buffer = outDirBuffer + dir1Size; -- trailingChar = *(buffer - 1); -- if (trailingChar != PATH_SEP) { -- *buffer = PATH_SEP; -- buffer++; -- } -- memcpy(buffer, dir2, dir2Size); -- buffer[dir2Size] = '\0'; -+ if (dir2[0] == '.') -+ return outDirBuffer; - -- return outDirBuffer; -+ buffer = outDirBuffer + dir1Size; -+ if (dir1Size > 0 && *(buffer - 1) != PATH_SEP) { -+ *buffer = PATH_SEP; -+ buffer++; -+ } -+ memcpy(buffer, dir2, dir2Size); -+ buffer[dir2Size] = '\0'; -+ -+ return outDirBuffer; -+ } - } - - /* this function will return NULL if input srcFileName is not valid name for mirrored output path */ --- -2.31.1 - diff --git a/Fix-nullptr-addition-improve-fuzzer.patch b/Fix-nullptr-addition-improve-fuzzer.patch deleted file mode 100644 index 2a3fadb7d3e713e1fc3872cdd8a2eb0472b587b5..0000000000000000000000000000000000000000 --- a/Fix-nullptr-addition-improve-fuzzer.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 86fff396cb01e0942db5ff76d142051626c3b2df Mon Sep 17 00:00:00 2001 -From: Nick Terrell -Date: Wed, 14 Dec 2022 17:00:54 -0800 -Subject: [PATCH] Fix nullptr addition & improve fuzzer - -Fix an instance of `NULL + 0` in `ZSTD_decompressStream()`. Also, improve our -`stream_decompress` fuzzer to pass `NULL` in/out buffers to -`ZSTD_decompressStream()`, and fix 2 issues that were immediately surfaced. - -Fixes #3351 ---- - lib/decompress/zstd_decompress.c | 9 +++++++-- - lib/legacy/zstd_v06.c | 3 ++- - lib/legacy/zstd_v07.c | 3 ++- - tests/fuzz/stream_decompress.c | 8 ++++---- - 4 files changed, 15 insertions(+), 8 deletions(-) - -diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c -index 0031e98c..96f79347 100644 ---- a/lib/decompress/zstd_decompress.c -+++ b/lib/decompress/zstd_decompress.c -@@ -2029,6 +2029,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB - size_t const decompressedSize = ZSTD_decompress_usingDDict(zds, op, (size_t)(oend-op), istart, cSize, ZSTD_getDDict(zds)); - if (ZSTD_isError(decompressedSize)) return decompressedSize; - DEBUGLOG(4, "shortcut to single-pass ZSTD_decompress_usingDDict()") -+ assert(istart != NULL); - ip = istart + cSize; - op += decompressedSize; - zds->expected = 0; -@@ -2114,6 +2115,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB - } - if ((size_t)(iend-ip) >= neededInSize) { /* decode directly from src */ - FORWARD_IF_ERROR(ZSTD_decompressContinueStream(zds, &op, oend, ip, neededInSize), ""); -+ assert(ip != NULL); - ip += neededInSize; - /* Function modifies the stage so we must break */ - break; -@@ -2137,8 +2139,11 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB - "should never happen"); - loadedSize = ZSTD_limitCopy(zds->inBuff + zds->inPos, toLoad, ip, (size_t)(iend-ip)); - } -- ip += loadedSize; -- zds->inPos += loadedSize; -+ if (loadedSize != 0) { -+ /* ip may be NULL */ -+ ip += loadedSize; -+ zds->inPos += loadedSize; -+ } - if (loadedSize < toLoad) { someMoreWork = 0; break; } /* not enough input, wait for more */ - - /* decode loaded input */ -diff --git a/lib/legacy/zstd_v06.c b/lib/legacy/zstd_v06.c -index ead213c4..a1f83495 100644 ---- a/lib/legacy/zstd_v06.c -+++ b/lib/legacy/zstd_v06.c -@@ -4035,7 +4035,8 @@ size_t ZBUFFv06_decompressContinue(ZBUFFv06_DCtx* zbd, - size_t const toLoad = hSize - zbd->lhSize; /* if hSize!=0, hSize > zbd->lhSize */ - if (ZSTDv06_isError(hSize)) return hSize; - if (toLoad > (size_t)(iend-ip)) { /* not enough input to load full header */ -- memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); -+ if (ip != NULL) -+ memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); - zbd->lhSize += iend-ip; - *dstCapacityPtr = 0; - return (hSize - zbd->lhSize) + ZSTDv06_blockHeaderSize; /* remaining header bytes + next block header */ -diff --git a/lib/legacy/zstd_v07.c b/lib/legacy/zstd_v07.c -index 3a0418e5..c15b1f4e 100644 ---- a/lib/legacy/zstd_v07.c -+++ b/lib/legacy/zstd_v07.c -@@ -4417,7 +4417,8 @@ size_t ZBUFFv07_decompressContinue(ZBUFFv07_DCtx* zbd, - if (hSize != 0) { - size_t const toLoad = hSize - zbd->lhSize; /* if hSize!=0, hSize > zbd->lhSize */ - if (toLoad > (size_t)(iend-ip)) { /* not enough input to load full header */ -- memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); -+ if (ip != NULL) -+ memcpy(zbd->headerBuffer + zbd->lhSize, ip, iend-ip); - zbd->lhSize += iend-ip; - *dstCapacityPtr = 0; - return (hSize - zbd->lhSize) + ZSTDv07_blockHeaderSize; /* remaining header bytes + next block header */ -diff --git a/tests/fuzz/stream_decompress.c b/tests/fuzz/stream_decompress.c -index e0cdd34d..86a39b8c 100644 ---- a/tests/fuzz/stream_decompress.c -+++ b/tests/fuzz/stream_decompress.c -@@ -99,14 +99,14 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size) - - while (size > 0) { - ZSTD_inBuffer in = makeInBuffer(&src, &size, producer); -- while (in.pos != in.size) { -+ do { -+ size_t const rc = ZSTD_decompressStream(dstream, &out, &in); -+ if (ZSTD_isError(rc)) goto error; - if (out.pos == out.size) { - if (stableOutBuffer) goto error; - out = makeOutBuffer(producer, buf, bufSize); - } -- size_t const rc = ZSTD_decompressStream(dstream, &out, &in); -- if (ZSTD_isError(rc)) goto error; -- } -+ } while (in.pos != in.size); - } - - error: --- -2.31.1 - diff --git a/Fix-required-decompression-memory-usage-reported-by-.patch b/Fix-required-decompression-memory-usage-reported-by-.patch deleted file mode 100644 index 62c1abe62b687152d3647810a6f115e7a2320368..0000000000000000000000000000000000000000 --- a/Fix-required-decompression-memory-usage-reported-by-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 470eb8330a9821c334df7efe66945a63d1faf017 Mon Sep 17 00:00:00 2001 -From: Jonathan McDowell -Date: Tue, 1 Feb 2022 03:20:30 -0800 -Subject: [PATCH] Fix required decompression memory usage reported by -vv + - --long - -The use of --long alters the window size internally in the underlying -library (lib/compress/zstd_compress.c:ZSTD_getCParamsFromCCtxParams), -which changes the memory required for decompression. This means that the -reported requirement from the zstd binary when -vv is specified is -incorrect. - -A full fix for this would be to add an API call to be able to retrieve -the required decompression memory from the library, but as a -lighterweight fix we can just take account of the fact we've enabled -long mode and update our verbose output appropriately. - -Fixes #2968 ---- - programs/fileio.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/programs/fileio.c b/programs/fileio.c -index 502f69c1..e37921ad 100644 ---- a/programs/fileio.c -+++ b/programs/fileio.c -@@ -1301,8 +1301,13 @@ FIO_compressZstdFrame(FIO_ctx_t* const fCtx, - UTIL_HumanReadableSize_t windowSize; - CHECK(ZSTD_CCtx_getParameter(ress.cctx, ZSTD_c_windowLog, &windowLog)); - if (windowLog == 0) { -- const ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, fileSize, 0); -- windowLog = cParams.windowLog; -+ if (prefs->ldmFlag) { -+ /* If long mode is set without a window size libzstd will set this size internally */ -+ windowLog = ZSTD_WINDOWLOG_LIMIT_DEFAULT; -+ } else { -+ const ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, fileSize, 0); -+ windowLog = cParams.windowLog; -+ } - } - windowSize = UTIL_makeHumanReadableSize(MAX(1ULL, MIN(1ULL << windowLog, pledgedSrcSize))); - DISPLAYLEVEL(4, "Decompression will require %.*f%s of memory\n", windowSize.precision, windowSize.value, windowSize.suffix); --- -2.31.1 - diff --git a/Fix-the-wrong-check-for-buffer-overrun-in-UTIL_merge.patch b/Fix-the-wrong-check-for-buffer-overrun-in-UTIL_merge.patch deleted file mode 100644 index 06458427f5c3692b7ab4a4e2199854375c8b386c..0000000000000000000000000000000000000000 --- a/Fix-the-wrong-check-for-buffer-overrun-in-UTIL_merge.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 361d86998ad877a678c5ffead30ecaf0c815c9aa Mon Sep 17 00:00:00 2001 -From: yiyuaner -Date: Mon, 24 Oct 2022 20:37:15 +0800 -Subject: [PATCH] Fix the wrong check for buffer overrun in - UTIL_mergeFileNamesTable - ---- - programs/util.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/programs/util.c b/programs/util.c -index a3af2621..7c4bb451 100644 ---- a/programs/util.c -+++ b/programs/util.c -@@ -569,7 +569,7 @@ UTIL_mergeFileNamesTable(FileNamesTable* table1, FileNamesTable* table2) - for( idx2=0 ; (idx2 < table2->tableSize) && table2->fileNames[idx2] && (pos < newTotalTableSize) ; ++idx2, ++newTableIdx) { - size_t const curLen = strlen(table2->fileNames[idx2]); - memcpy(buf+pos, table2->fileNames[idx2], curLen); -- assert(newTableIdx <= newTable->tableSize); -+ assert(newTableIdx < newTable->tableSize); - newTable->fileNames[newTableIdx] = buf+pos; - pos += curLen+1; - } } --- -2.31.1 - diff --git a/dibio-Fix-assertion-triggered-by-no-inputs.patch b/dibio-Fix-assertion-triggered-by-no-inputs.patch deleted file mode 100644 index 6f550860ead482c7f9e4dbaa7785ba48a0f96605..0000000000000000000000000000000000000000 --- a/dibio-Fix-assertion-triggered-by-no-inputs.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 246982e782849d8646b2d5df6648319935669228 Mon Sep 17 00:00:00 2001 -From: Nick Terrell -Date: Thu, 20 Jan 2022 22:41:47 -0800 -Subject: [PATCH] [dibio] Fix assertion triggered by no inputs - -Passing 0 inputs to `DiB_shuffle()` caused an assertion failure where -it should just return. - -A test is added in a later commit, with the initial introduction of the -new testing framework. - -Fixes #3007. ---- - programs/dibio.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/programs/dibio.c b/programs/dibio.c -index d19f9544..147d1e7b 100644 ---- a/programs/dibio.c -+++ b/programs/dibio.c -@@ -27,9 +27,9 @@ - #include /* memset */ - #include /* fprintf, fopen, ftello64 */ - #include /* errno */ --#include - - #include "timefn.h" /* UTIL_time_t, UTIL_clockSpanMicro, UTIL_getTime */ -+#include "../lib/common/debug.h" /* assert */ - #include "../lib/common/mem.h" /* read */ - #include "dibio.h" - -@@ -193,7 +193,8 @@ static U32 DiB_rand(U32* src) - static void DiB_shuffle(const char** fileNamesTable, unsigned nbFiles) { - U32 seed = 0xFD2FB528; - unsigned i; -- assert(nbFiles >= 1); -+ if (nbFiles == 0) -+ return; - for (i = nbFiles - 1; i > 0; --i) { - unsigned const j = DiB_rand(&seed) % (i + 1); - const char* const tmp = fileNamesTable[j]; --- -2.31.1 - diff --git a/enable-CET.patch b/enable-CET.patch deleted file mode 100644 index 335e95d33cdaf55e2f2669c35f4e205b1e20eb05..0000000000000000000000000000000000000000 --- a/enable-CET.patch +++ /dev/null @@ -1,38 +0,0 @@ -From cd7620a730413a48843e175d34dc408c152f8125 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Tue, 11 Jan 2022 07:28:25 -0800 -Subject: [PATCH] x86-64: Enable Intel CET - -Intel Control-flow Enforcement Technology (CET): - -https://en.wikipedia.org/wiki/Control-flow_integrity#Intel_Control-flow_Enforcement_Technology - -requires that on Linux, all linker input files are marked as CET enabled -in .note.gnu.property section. For high-level language source codes, -.note.gnu.property section is added by compiler with the -fcf-protection -option. For assembly sources, include to add .note.gnu.property -section. ---- - lib/common/portability_macros.h | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/lib/common/portability_macros.h b/lib/common/portability_macros.h -index 627ef9eed4..6ac4b05510 100644 ---- a/lib/common/portability_macros.h -+++ b/lib/common/portability_macros.h -@@ -128,4 +128,15 @@ - # define ZSTD_ENABLE_ASM_X86_64_BMI2 0 - #endif - -+/* -+ * For x86 ELF targets, add .note.gnu.property section for Intel CET in -+ * assembly sources when CET is enabled. -+ */ -+#if defined(__ELF__) && (defined(__x86_64__) || defined(__i386__)) \ -+ && defined(__has_include) -+# if __has_include() -+# include -+# endif -+#endif -+ - #endif /* ZSTD_PORTABILITY_MACROS_H */ diff --git a/fix-for-error-message-in-recursive-mode-for-an-empty.patch b/fix-for-error-message-in-recursive-mode-for-an-empty.patch deleted file mode 100644 index 3a2fe4a87b7079c80e541c84992d13bd3e70cff4..0000000000000000000000000000000000000000 --- a/fix-for-error-message-in-recursive-mode-for-an-empty.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 4021b784376c3790c077e9b8deedbb6a4f016687 Mon Sep 17 00:00:00 2001 -From: brailovich <91924341+brailovich@users.noreply.github.com> -Date: Mon, 24 Jan 2022 17:42:21 -0800 -Subject: [PATCH] fix for error message in recursive mode for an empty folder - --r on empty directory resulted in zstd waiting input from stdin. now zstd exits without error and prints a warning message explaining why no processing happened (no files or directories to process). ---- - programs/zstdcli.c | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) - -diff --git a/programs/zstdcli.c b/programs/zstdcli.c -index fd563e1c..34d2fa6e 100644 ---- a/programs/zstdcli.c -+++ b/programs/zstdcli.c -@@ -834,6 +834,7 @@ int main(int argCount, const char* argv[]) - size_t streamSrcSize = 0; - size_t targetCBlockSize = 0; - size_t srcSizeHint = 0; -+ size_t nbInputFileNames = 0; - int dictCLevel = g_defaultDictCLevel; - unsigned dictSelect = g_defaultSelectivityLevel; - #ifndef ZSTD_NODICT -@@ -1256,6 +1257,8 @@ int main(int argCount, const char* argv[]) - } - } - -+ nbInputFileNames = filenames->tableSize; /* saving number of input files */ -+ - if (recursive) { /* at this stage, filenameTable is a list of paths, which can contain both files and directories */ - UTIL_expandFNT(&filenames, followLinks); - } -@@ -1358,7 +1361,17 @@ int main(int argCount, const char* argv[]) - #endif - - /* No input filename ==> use stdin and stdout */ -- if (filenames->tableSize == 0) UTIL_refFilename(filenames, stdinmark); -+ if (filenames->tableSize == 0) { -+ /* It is possible that the input -+ was a number of empty directories. In this case -+ stdin and stdout should not be used */ -+ if (nbInputFileNames > 0 ){ -+ DISPLAYLEVEL(2, "please provide correct input file(s) or non-empty directories -- ignored \n"); -+ CLEAN_RETURN(2); -+ } -+ UTIL_refFilename(filenames, stdinmark); -+ } -+ - if (!strcmp(filenames->fileNames[0], stdinmark) && !outFileName) - outFileName = stdoutmark; /* when input is stdin, default output is stdout */ - --- -2.31.1 - diff --git a/fix-issue-3119.patch b/fix-issue-3119.patch deleted file mode 100644 index 944342e8930147aee7d72ac63d287166d6f35b80..0000000000000000000000000000000000000000 --- a/fix-issue-3119.patch +++ /dev/null @@ -1,53 +0,0 @@ -From b7d55cfa0d0942c2cb74d47076847c401653f9ed Mon Sep 17 00:00:00 2001 -From: Yann Collet -Date: Wed, 27 Apr 2022 20:51:56 -0700 -Subject: [PATCH] fix issue #3119 - -fix segfault error when running zstreamtest with MALLOC_PERTURB_ ---- - lib/common/pool.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/lib/common/pool.c b/lib/common/pool.c -index 5c1d07d3..bf21c57e 100644 ---- a/lib/common/pool.c -+++ b/lib/common/pool.c -@@ -12,7 +12,7 @@ - /* ====== Dependencies ======= */ - #include "zstd_deps.h" /* size_t */ - #include "debug.h" /* assert */ --#include "zstd_internal.h" /* ZSTD_customMalloc, ZSTD_customFree */ -+#include "zstd_internal.h" /* ZSTD_customCalloc, ZSTD_customFree */ - #include "pool.h" - - /* ====== Compiler specifics ====== */ -@@ -126,7 +126,7 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, - * empty and full queues. - */ - ctx->queueSize = queueSize + 1; -- ctx->queue = (POOL_job*)ZSTD_customMalloc(ctx->queueSize * sizeof(POOL_job), customMem); -+ ctx->queue = (POOL_job*)ZSTD_customCalloc(ctx->queueSize * sizeof(POOL_job), customMem); - ctx->queueHead = 0; - ctx->queueTail = 0; - ctx->numThreadsBusy = 0; -@@ -140,7 +140,7 @@ POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, - } - ctx->shutdown = 0; - /* Allocate space for the thread handles */ -- ctx->threads = (ZSTD_pthread_t*)ZSTD_customMalloc(numThreads * sizeof(ZSTD_pthread_t), customMem); -+ ctx->threads = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), customMem); - ctx->threadCapacity = 0; - ctx->customMem = customMem; - /* Check for errors */ -@@ -220,7 +220,7 @@ static int POOL_resize_internal(POOL_ctx* ctx, size_t numThreads) - return 0; - } - /* numThreads > threadCapacity */ -- { ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_customMalloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem); -+ { ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_customCalloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem); - if (!threadPool) return 1; - /* replace existing thread pool */ - ZSTD_memcpy(threadPool, ctx->threads, ctx->threadCapacity * sizeof(*threadPool)); --- -2.31.1 - diff --git a/fix-the-assertion-in-readLinesFromFile-3084.patch b/fix-the-assertion-in-readLinesFromFile-3084.patch deleted file mode 100644 index f655e0ef164f727e62c653603d8ba961aa1e0039..0000000000000000000000000000000000000000 --- a/fix-the-assertion-in-readLinesFromFile-3084.patch +++ /dev/null @@ -1,50 +0,0 @@ -From d109cef2012b1e0ca7a6f47278a2838f68bbc196 Mon Sep 17 00:00:00 2001 -From: Xi Ruoyao -Date: Sat, 5 Mar 2022 03:56:44 +0800 -Subject: [PATCH] fix the assertion in readLinesFromFile (#3084) - -* fix the assertion in readLinesFromFile - -When the file is not terminated by endline, readLineFromFile will append -a '\0' for the last line. In this case pos + lineLength == dstCapacity. - -* test: don't print very long text garbage ---- - programs/util.c | 2 +- - tests/playTests.sh | 4 ++-- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/programs/util.c b/programs/util.c -index d69b72a3..55bcff25 100644 ---- a/programs/util.c -+++ b/programs/util.c -@@ -418,7 +418,7 @@ readLinesFromFile(void* dst, size_t dstCapacity, - while ( !feof(inputFile) ) { - size_t const lineLength = readLineFromFile(buf+pos, dstCapacity-pos, inputFile); - if (lineLength == 0) break; -- assert(pos + lineLength < dstCapacity); -+ assert(pos + lineLength <= dstCapacity); /* '=' for inputFile not terminated with '\n' */ - pos += lineLength; - ++nbFiles; - } -diff --git a/tests/playTests.sh b/tests/playTests.sh -index 71e8dc05..d4271b2f 100755 ---- a/tests/playTests.sh -+++ b/tests/playTests.sh -@@ -735,11 +735,11 @@ test -f tmp4 - - println "test : survive the list of files with too long filenames (--filelist=FILE)" - datagen -g5M > tmp_badList --zstd -f --filelist=tmp_badList && die "should have failed : file name length is too long" -+zstd -qq -f --filelist=tmp_badList && die "should have failed : file name length is too long" # printing very long text garbage on console will cause CI failure - - println "test : survive a list of files which is text garbage (--filelist=FILE)" - datagen > tmp_badList --zstd -f --filelist=tmp_badList && die "should have failed : list is text garbage" -+zstd -qq -f --filelist=tmp_badList && die "should have failed : list is text garbage" # printing very long text garbage on console will cause CI failure - - println "test : survive a list of files which is binary garbage (--filelist=FILE)" - datagen -P0 -g1M > tmp_badList --- -2.31.1 - diff --git a/pzstd.1.patch b/pzstd.1.patch index 30243d4a3ef92f17165008ad50e0b5b8c63e3448..e6016c7de63327b410451828200ab0a0802ee053 100644 --- a/pzstd.1.patch +++ b/pzstd.1.patch @@ -1,9 +1,9 @@ -diff -Naur zstd-1.5.2.orig/programs/zstd.1 zstd-1.5.2/programs/zstd.1 ---- zstd-1.5.2.orig/programs/zstd.1 2022-01-20 21:17:18.000000000 +0000 -+++ zstd-1.5.2/programs/zstd.1 2022-01-22 17:40:54.130314058 +0000 -@@ -214,6 +214,13 @@ - . - .IP "\(bu" 4 +diff -Naur zstd-1.5.4/programs/zstd.1 zstd-1.5.4.new/programs/zstd.1 +--- zstd-1.5.4/programs/zstd.1 2023-02-10 00:41:50.000000000 +0000 ++++ zstd-1.5.4.new/programs/zstd.1 2023-02-13 12:44:01.575160149 +0000 +@@ -162,6 +162,13 @@ + \fB\-\-show\-default\-cparams\fR: shows the default compression parameters that will be used for a particular input file, based on the provided compression level and the input size\. If the provided file is not a regular file (e\.g\. a pipe), this flag will output the parameters used for inputs of unknown size\. + .IP "\[ci]" 4 \fB\-\-\fR: All arguments after \fB\-\-\fR are treated as files + +.SH Parallel Zstd OPTIONS @@ -12,6 +12,6 @@ diff -Naur zstd-1.5.2.orig/programs/zstd.1 zstd-1.5.2/programs/zstd.1 +.BR \-p ", " --processes + number of threads to use for (de)compression (default:4) + - . .IP "" 0 - . + .SS "gzip Operation Modifiers" + When invoked via a \fBgzip\fR symlink, \fBzstd\fR will support further options that intend to mimic the \fBgzip\fR behavior: diff --git a/stdin-multiple-file-fixes-3222.patch b/stdin-multiple-file-fixes-3222.patch deleted file mode 100644 index 929747f774c15c101db78b63adeaf3806b8d22e1..0000000000000000000000000000000000000000 --- a/stdin-multiple-file-fixes-3222.patch +++ /dev/null @@ -1,160 +0,0 @@ -From bedc03ed0f5222dad8d3fd4830a242e317471969 Mon Sep 17 00:00:00 2001 -From: Yonatan Komornik <11005061+yoniko@users.noreply.github.com> -Date: Fri, 29 Jul 2022 16:13:07 -0700 -Subject: [PATCH] stdin multiple file fixes (#3222) - -* Fixes for https://github.com/facebook/zstd/issues/3206 - bugs when handling stdin as part of multiple files. - -* new line at end of multiple-files.sh ---- - programs/fileio.c | 10 +++++++++ - programs/util.c | 10 +++++++++ - programs/util.h | 5 +++++ - programs/zstdcli.c | 8 +++---- - tests/cli-tests/compression/multiple-files.sh | 21 +++++++++++++++++++ - .../multiple-files.sh.stdout.exact | 12 +++++++++++ - 6 files changed, 62 insertions(+), 4 deletions(-) - create mode 100755 tests/cli-tests/compression/multiple-files.sh - create mode 100644 tests/cli-tests/compression/multiple-files.sh.stdout.exact - -diff --git a/programs/fileio.c b/programs/fileio.c -index 1dade664..327eb3ae 100644 ---- a/programs/fileio.c -+++ b/programs/fileio.c -@@ -1871,6 +1871,11 @@ FIO_determineCompressedName(const char* srcFileName, const char* outDirName, con - char* outDirFilename = NULL; - size_t sfnSize = strlen(srcFileName); - size_t const srcSuffixLen = strlen(suffix); -+ -+ if(!strcmp(srcFileName, stdinmark)) { -+ return stdoutmark; -+ } -+ - if (outDirName) { - outDirFilename = FIO_createFilename_fromOutDir(srcFileName, outDirName, srcSuffixLen); - sfnSize = strlen(outDirFilename); -@@ -2793,6 +2798,11 @@ FIO_determineDstName(const char* srcFileName, const char* outDirName) - - size_t srcSuffixLen; - const char* const srcSuffix = strrchr(srcFileName, '.'); -+ -+ if(!strcmp(srcFileName, stdinmark)) { -+ return stdoutmark; -+ } -+ - if (srcSuffix == NULL) { - DISPLAYLEVEL(1, - "zstd: %s: unknown suffix (%s expected). " -diff --git a/programs/util.c b/programs/util.c -index 31553577..b087ace9 100644 ---- a/programs/util.c -+++ b/programs/util.c -@@ -509,6 +509,16 @@ FileNamesTable* UTIL_allocateFileNamesTable(size_t tableSize) - return fnt; - } - -+int UTIL_searchFileNamesTable(FileNamesTable* table, char const* name) { -+ size_t i; -+ for(i=0 ;i < table->tableSize; i++) { -+ if(!strcmp(table->fileNames[i], name)) { -+ return (int)i; -+ } -+ } -+ return -1; -+} -+ - void UTIL_refFilename(FileNamesTable* fnt, const char* filename) - { - assert(fnt->tableSize < fnt->tableCapacity); -diff --git a/programs/util.h b/programs/util.h -index add165d5..faf8c9f1 100644 ---- a/programs/util.h -+++ b/programs/util.h -@@ -269,6 +269,11 @@ UTIL_createFNT_fromROTable(const char** filenames, size_t nbFilenames); - */ - FileNamesTable* UTIL_allocateFileNamesTable(size_t tableSize); - -+/*! UTIL_searchFileNamesTable() : -+ * Searched through entries in FileNamesTable for a specific name. -+ * @return : index of entry if found or -1 if not found -+ */ -+int UTIL_searchFileNamesTable(FileNamesTable* table, char const* name); - - /*! UTIL_refFilename() : - * Add a reference to read-only name into @fnt table. -diff --git a/programs/zstdcli.c b/programs/zstdcli.c -index 949fe593..abe82b1a 100644 ---- a/programs/zstdcli.c -+++ b/programs/zstdcli.c -@@ -1367,19 +1367,19 @@ int main(int argCount, const char* argv[]) - UTIL_refFilename(filenames, stdinmark); - } - -- if (!strcmp(filenames->fileNames[0], stdinmark) && !outFileName) -+ if (filenames->tableSize == 1 && !strcmp(filenames->fileNames[0], stdinmark) && !outFileName) - outFileName = stdoutmark; /* when input is stdin, default output is stdout */ - - /* Check if input/output defined as console; trigger an error in this case */ - if (!forceStdin -- && !strcmp(filenames->fileNames[0], stdinmark) -+ && (UTIL_searchFileNamesTable(filenames, stdinmark) != -1) - && IS_CONSOLE(stdin) ) { - DISPLAYLEVEL(1, "stdin is a console, aborting\n"); - CLEAN_RETURN(1); - } -- if ( outFileName && !strcmp(outFileName, stdoutmark) -+ if ( (!outFileName || !strcmp(outFileName, stdoutmark)) - && IS_CONSOLE(stdout) -- && !strcmp(filenames->fileNames[0], stdinmark) -+ && (UTIL_searchFileNamesTable(filenames, stdinmark) != -1) - && !forceStdout - && operation!=zom_decompress ) { - DISPLAYLEVEL(1, "stdout is a console, aborting\n"); -diff --git a/tests/cli-tests/compression/multiple-files.sh b/tests/cli-tests/compression/multiple-files.sh -new file mode 100755 -index 00000000..aeb74cf2 ---- /dev/null -+++ b/tests/cli-tests/compression/multiple-files.sh -@@ -0,0 +1,21 @@ -+#!/bin/sh -+set -e -+ -+# setup -+echo "file1" > file1 -+echo "file2" > file2 -+ -+echo "Test zstd ./file1 - file2" -+rm -f ./file*.zst -+echo "stdin" | zstd ./file1 - ./file2 | zstd -d -+cat file1.zst | zstd -d -+cat file2.zst | zstd -d -+ -+echo "Test zstd -d ./file1.zst - file2.zst" -+rm ./file1 ./file2 -+echo "stdin" | zstd - | zstd -d ./file1.zst - file2.zst -+cat file1 -+cat file2 -+ -+echo "zstd -d ./file1.zst - file2.zst -c" -+echo "stdin" | zstd | zstd -d ./file1.zst - file2.zst -c -diff --git a/tests/cli-tests/compression/multiple-files.sh.stdout.exact b/tests/cli-tests/compression/multiple-files.sh.stdout.exact -new file mode 100644 -index 00000000..aad61d63 ---- /dev/null -+++ b/tests/cli-tests/compression/multiple-files.sh.stdout.exact -@@ -0,0 +1,12 @@ -+Test zstd ./file1 - file2 -+stdin -+file1 -+file2 -+Test zstd -d ./file1.zst - file2.zst -+stdin -+file1 -+file2 -+zstd -d ./file1.zst - file2.zst -c -+file1 -+stdin -+file2 --- -2.31.1 - diff --git a/zstd-1.5.2.tar.zst b/zstd-1.5.2.tar.zst deleted file mode 100644 index 61e5633328595163e600a1673233a880d1062bbd..0000000000000000000000000000000000000000 Binary files a/zstd-1.5.2.tar.zst and /dev/null differ diff --git a/zstd-1.5.4.tar.zst b/zstd-1.5.4.tar.zst new file mode 100644 index 0000000000000000000000000000000000000000..5ee61ed4f6470111fe706205c99a79b81c9502bc Binary files /dev/null and b/zstd-1.5.4.tar.zst differ diff --git a/zstd.spec b/zstd.spec index 95d175d033bd7e2957df60ed41bedf4892cc5c8f..ee58cec1fdf772e8aa903a9ff961b8e8a8504276 100644 --- a/zstd.spec +++ b/zstd.spec @@ -1,17 +1,13 @@ -%define anolis_release 4 +%define anolis_release 1 %bcond_without asm %bcond_without lz4 %bcond_without lzma %bcond_without zlib -%ifarch x86_64 %bcond_without pzstd -%else -%bcond_with pzstd -%endif Name: zstd -Version: 1.5.2 +Version: 1.5.4 Release: %{anolis_release}%{?dist} Summary: Zstd compression library @@ -20,27 +16,8 @@ URL: https://github.com/facebook/zstd Source0: https://github.com/facebook/zstd/releases/download/v%{version}/%{name}-%{version}.tar.zst Patch1: pzstd.1.patch -Patch2: enable-CET.patch -# https://github.com/facebook/zstd/commit/4021b784376c3790c077e9b8deedbb6a4f016687 -Patch3: fix-for-error-message-in-recursive-mode-for-an-empty.patch -# https://github.com/facebook/zstd/commit/246982e782849d8646b2d5df6648319935669228 -Patch4: dibio-Fix-assertion-triggered-by-no-inputs.patch -# https://github.com/facebook/zstd/commit/470eb8330a9821c334df7efe66945a63d1faf017 -Patch5: Fix-required-decompression-memory-usage-reported-by-.patch -# https://github.com/facebook/zstd/commit/d109cef2012b1e0ca7a6f47278a2838f68bbc196 -Patch6: fix-the-assertion-in-readLinesFromFile-3084.patch -# https://github.com/facebook/zstd/commit/e1873ad576cb478fff0e6e44ad99599cd5fd2846 -Patch7: Fix-buffer-underflow-for-null-dir1.patch -# https://github.com/facebook/zstd/commit/ae4670466c5db56493f356c1a81e8cbefef3271e -Patch8: stdin-multiple-file-fixes-3222.patch -# https://github.com/facebook/zstd/commit/b7d55cfa0d0942c2cb74d47076847c401653f9ed -Patch9: fix-issue-3119.patch -# https://github.com/facebook/zstd/commit/361d86998ad877a678c5ffead30ecaf0c815c9aa -Patch10: Fix-the-wrong-check-for-buffer-overrun-in-UTIL_merge.patch -# https://github.com/facebook/zstd/commit/f31b83ff34236b4c8ec7dc5332c52a7e67952215 -Patch11: Fix-nullptr-addition-improve-fuzzer.patch - -BuildRequires: make cmake + +BuildRequires: make cmake BuildRequires: gcc gtest-devel %if %{with lz4} BuildRequires: lz4-devel @@ -55,6 +32,7 @@ BuildRequires: gcc-c++ BuildRequires: zlib-devel %endif BuildRequires: execstack +Requires: lib%{name} = %{version}-%{release} %description Zstd, short for Zstandard, is a fast lossless compression algorithm, @@ -94,7 +72,6 @@ find -name .gitignore -delete %if %{with pzstd} %patch1 -p1 %endif -%autopatch -p1 -m 2 %build export CFLAGS="$RPM_OPT_FLAGS" @@ -108,11 +85,12 @@ export CXXFLAGS="$RPM_OPT_FLAGS" %make_build -C contrib/pzstd %{!?with_asm:ZSTD_NO_ASM=1} %endif -cd build/cmake +pushd build/cmake mkdir builddir cd builddir cmake .. -make +%make_build +popd %install %make_install PREFIX=%{_prefix} LIBDIR=%{_libdir} @@ -132,6 +110,7 @@ popd %check execstack lib/libzstd.so.1 + export CFLAGS="$RPM_OPT_FLAGS" export LDFLAGS="$RPM_LD_FLAGS" make -C tests test-zstd @@ -140,7 +119,6 @@ export CXXFLAGS="$RPM_OPT_FLAGS" make -C contrib/pzstd test %endif - %files %license COPYING LICENSE %{_bindir}/%{name} @@ -181,9 +159,10 @@ make -C contrib/pzstd test %files -n lib%{name}-static %{_libdir}/libzstd.a -%ldconfig_scriptlets -n lib%{name} - %changelog +* Sat Feb 25 2023 Funda Wang - 1.5.4-1 +- New version 1.5.4 + * Sun Jan 08 2023 Shawn Wang - 1.5.2-4 - add some patches from upstream