From: Pádraig Brady
Date: Tue, 2 Jan 2018 15:17:32 +0000 (+0000)
Subject: zstd: fix crash when not overwriting existing files
X-Git-Tag: v1.3.4~1^2~95^2
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0596715dcf57cd431394d923d63dfe5aaf49749;p=thirdparty%2Fzstd.git
zstd: fix crash when not overwriting existing files
This fixes the following crash:
$ touch exists
$ programs/zstd -r examples/ -o exists
zstd: exists already exists; not overwritten
Segmentation fault (core dumped)
* programs/fileio.c (FIO_compressMultipleFilenames):
Handle the case where we're not overwriting the destination.
Reported at https://bugzilla.redhat.com/1530049
---
diff --git a/programs/fileio.c b/programs/fileio.c
index b57ce14d2..f9c9087ba 100644
--- a/programs/fileio.c
+++ b/programs/fileio.c
@@ -951,10 +951,14 @@ int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFile
if (outFileName != NULL) {
unsigned u;
ress.dstFile = FIO_openDstFile(outFileName);
- for (u=0; u