aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/api
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-08-18 17:16:49 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-08-18 17:16:49 +0300
commitc4e8e5fb311225b8b48d34157891a640b2535e0c (patch)
treea7ac08bc9dcf279eb495abc07b49686774d699ed /src/liblzma/api
parentAdd NEWS for 5.2.6. (diff)
downloadxz-c4e8e5fb311225b8b48d34157891a640b2535e0c.tar.xz
liblzma: Threaded decoder: Improve LZMA_FAIL_FAST when LZMA_FINISH is used.
It will now return LZMA_DATA_ERROR (not LZMA_OK or LZMA_BUF_ERROR) if LZMA_FINISH is used and there isn't enough input to finish decoding the Block Header or the Block. The use of LZMA_DATA_ERROR is simpler and the less risky than LZMA_BUF_ERROR but this might be changed before 5.4.0.
Diffstat (limited to 'src/liblzma/api')
-rw-r--r--src/liblzma/api/lzma/container.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/liblzma/api/lzma/container.h b/src/liblzma/api/lzma/container.h
index 564c6aaf..c0e1f5b4 100644
--- a/src/liblzma/api/lzma/container.h
+++ b/src/liblzma/api/lzma/container.h
@@ -623,6 +623,12 @@ extern LZMA_API(lzma_ret) lzma_microlzma_encoder(
* decompressed multiple times with this flag, a different amount of output
* may be produced by different runs, and even the error code might vary.
*
+ * When using LZMA_FAIL_FAST, it is recommended to use LZMA_FINISH to tell
+ * the decoder when no more input will be coming because it can help fast
+ * detection and reporting of truncated files. Note that in this situation
+ * truncated files might be diagnosed with LZMA_DATA_ERROR instead of
+ * LZMA_OK or LZMA_BUF_ERROR!
+ *
* Without this flag the threaded decoder will provide as much output as
* possible at first and then report the pending error. This default behavior
* matches the single-threaded decoder and provides repeatable behavior