Commit 46b84e9b for xz
commit 46b84e9bf5a8181573166bfc5048ff211e0d5b8f
Author: Lasse Collin <lasse.collin@tukaani.org>
Date: Sat Nov 28 17:39:46 2026 +0200
liblzma: Document lzma_memusage() bugs
diff --git a/src/liblzma/api/lzma/base.h b/src/liblzma/api/lzma/base.h
index 00499381..e130a4b8 100644
--- a/src/liblzma/api/lzma/base.h
+++ b/src/liblzma/api/lzma/base.h
@@ -690,6 +690,17 @@ extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
* this may give misleading information if decoding .xz Streams that have
* multiple Blocks, because each Block can have different memory requirements.
*
+ * Bugs in liblzma 5.8.4 and older:
+ * - lzma_stream_decoder_mt(): If lzma_code() returned LZMA_MEMLIMIT_ERROR,
+ * then lzma_memusage() returned a bogus value that was smaller than the
+ * required amount of memory. lzma_memlimit_set() accepted the value, but
+ * continuing with lzma_code() kept failing with LZMA_MEMLIMIT_ERROR.
+ * - lzma_stream_decoder(), lzma_alone_decoder(), and lzma_lzip_decoder():
+ * If lzma_memusage() was called immediately after a lzma_stream had been
+ * reinitialized, lzma_memusage() didn't account for the memory that was
+ * cached from the previous initialization. lzma_memusage() returned
+ * correct information once at least one output byte was produced.
+ *
* \param strm Pointer to lzma_stream that is at least initialized
* with LZMA_STREAM_INIT.
*