Commit b387ea5a for xz
commit b387ea5a87b70fffbb359c63b10f2cbb67733e22
Author: Lasse Collin <lasse.collin@tukaani.org>
Date: Tue Nov 17 19:01:18 2026 +0200
liblzma: Add a null pointer check to lzma_get_progress()
If lzma_get_progress() was called when no coder was initialized in
the lzma_stream, it would crash due to strm->internal being NULL.
Apps shouldn't have any need to call lzma_get_progress() on such
lzma_streams, but it must still work.
Reported-by: GitHub user katie-andtruth
Reported-by: Pu Cheng
Closes: https://github.com/tukaani-project/xz/pull/267
diff --git a/src/liblzma/common/common.c b/src/liblzma/common/common.c
index 7f73559e..6211e46d 100644
--- a/src/liblzma/common/common.c
+++ b/src/liblzma/common/common.c
@@ -410,7 +410,8 @@ extern LZMA_API(void)
lzma_get_progress(lzma_stream *strm,
uint64_t *progress_in, uint64_t *progress_out)
{
- if (strm->internal->next.get_progress != NULL) {
+ if (strm->internal != NULL
+ && strm->internal->next.get_progress != NULL) {
strm->internal->next.get_progress(strm->internal->next.coder,
progress_in, progress_out);
} else {