]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix : ZBUFF_compressEnd() gives right amount remaining to flush, including future...
authorYann Collet <yann.collet.73@gmail.com>
Tue, 21 Jun 2016 12:04:57 +0000 (14:04 +0200)
committerYann Collet <yann.collet.73@gmail.com>
Tue, 21 Jun 2016 12:04:57 +0000 (14:04 +0200)
NEWS
lib/compress/zbuff_compress.c

diff --git a/NEWS b/NEWS
index 0e8d87d62ca21a3beceeccf17da5adc454f748d3..ac832b12dcce7f5c7e990466d705aa5e08a0cd43 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
 v0.7.1
+fixed : ZBUFF_compressEnd() called multiple times with too small `dst` buffer, reported by Christophe Chevalier
 fixed : corruption issue, reported by cj
 modified : checksum enabled by default in command line mode
 
index d4ea217c25468b4b8a668f51f8d1bd7decc06af3..023f92594dd754c774ae2ca011e8c473acdc6741 100644 (file)
@@ -297,7 +297,7 @@ size_t ZBUFF_compressEnd(ZBUFF_CCtx* zbc, void* dst, size_t* dstCapacityPtr)
         op += outSize;
         if (remainingToFlush) {
             *dstCapacityPtr = op-ostart;
-            return remainingToFlush;
+            return remainingToFlush + (ZSTD_BLOCKHEADERSIZE * (zbc->stage != ZBUFFcs_final));
     }   }
 
     if (zbc->stage == ZBUFFcs_final) { zbc->stage = ZBUFFcs_init; *dstCapacityPtr = op-ostart; return 0; }