]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed decoding bogus lz4 frame 1112/head
authorcyan4973 <yann.collet.73@gmail.com>
Tue, 24 Apr 2018 01:50:16 +0000 (18:50 -0700)
committercyan4973 <yann.collet.73@gmail.com>
Tue, 24 Apr 2018 01:50:16 +0000 (18:50 -0700)
FIO would keep presenting data after an LZ4F decoding error
resulting in a NULL pointer dereference
when associated with older liblz4 version (< v1.8.1.2)

programs/fileio.c

index 5e3928ef39d13ae9eabfb9be82b4883e0b1a1676..d5b389e1eaf864e93d7d5566eef46d96180f91b1 100644 (file)
@@ -1487,7 +1487,7 @@ static unsigned long long FIO_decompressLz4Frame(dRess_t* ress,
             if (LZ4F_isError(nextToLoad)) {
                 DISPLAYLEVEL(1, "zstd: %s: lz4 decompression error : %s \n",
                                 srcFileName, LZ4F_getErrorName(nextToLoad));
-                decodingError = 1; break;
+                decodingError = 1; nextToLoad = 0; break;
             }
             pos += remaining;
 
@@ -1495,7 +1495,7 @@ static unsigned long long FIO_decompressLz4Frame(dRess_t* ress,
             if (decodedBytes) {
                 if (fwrite(ress->dstBuffer, 1, decodedBytes, ress->dstFile) != decodedBytes) {
                     DISPLAYLEVEL(1, "zstd: %s \n", strerror(errno));
-                    decodingError = 1; break;
+                    decodingError = 1; nextToLoad = 0; break;
                 }
                 filesize += decodedBytes;
                 DISPLAYUPDATE(2, "\rDecompressed : %u MB  ", (unsigned)(filesize>>20));