From 62487b5e761ccd9a1a92bff7c38693f2f8008c74 Mon Sep 17 00:00:00 2001 From: cyan4973 Date: Mon, 23 Apr 2018 18:50:16 -0700 Subject: [PATCH] fixed decoding bogus lz4 frame 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/fileio.c b/programs/fileio.c index 5e3928ef..d5b389e1 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -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));