package/xz: add upstream security fix for CVE-2026-34743
Fixes the following vulnerability:
CVE-2026-34743: XZ Utils: Buffer overflow in lzma_index_append()
If lzma_index_decoder() was used to decode an Index that contained no Records, the resulting lzma_index was left in a state where where a subsequent lzma_index_append() would allocate too little memory, and a buffer overflow would occur.
The lzma_index functions are rarely used by applications directly. In the few applications that do use these functions, the combination of function calls required to trigger this bug are unlikely to exist, because there typically is no reason to append Records to a decoded lzma_index. Thus, it's likely that this bug cannot be triggered in any real-world application.
This bug is older than xz 5.0.0, so all stable releases are affected. The issue has been fixed in XZ Utils 5.8.3 and in the Git repository branch v5.8. The fix is also available in the Git repository branches v5.6, v5.4, and v5.2, but no new releases will be made from these old branches.
https://github.com/tukaani-project/xz/security/advisories/GHSA-x872-m794-cxhv
--- ...buffer-overflow-in-lzma_index_append.patch | 66 +++++++++++++++++++ package/xz/xz.mk | 3 + 2 files changed, 69 insertions(+) create mode 100644 package/xz/0005-liblzma-Fix-a-buffer-overflow-in-lzma_index_append.patch
package/xz/0005-liblzma-Fix-a-buffer-overflow-in-lzma_index_append.patch new file +66 -0
@@ -0,0 +1,66 @@ +From 8287299ba858bd7ee767fe6eabcc050574616bf4 Mon Sep 17 00:00:00 2001 +From: Lasse Collin <[email protected]> +Date: Sun, 29 Mar 2026 19:11:21 +0300 +Subject: [PATCH] liblzma: Fix a buffer overflow in lzma_index_append() + +If lzma_index_decoder() was used to decode an Index that contained no +Records, the resulting lzma_index had an invalid internal "prealloc" +value. If lzma_index_append() was called on this lzma_index, too +little memory would be allocated and a buffer overflow would occur. + +While this combination of the API functions is meant to work, in the +real-world apps this call sequence is rare or might not exist at all. + +This bug is older than xz 5.0.0, so all stable releases are affected. + +Reported-by: GitHub user christos-spearbit +(cherry picked from commit c8c22869e780ff57c96b46939c3d79ff99395f87) +CVE: CVE-2026-34743 +Upstream: https://github.com/tukaani-project/xz/commit/8287299ba858bd7ee767fe6eabcc050574616bf4 +Signed-off-by: Peter Korsgaard <[email protected]> +--- + src/liblzma/common/index.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c +index 6add6a68..c4aadb9b 100644 +--- a/src/liblzma/common/index.c ++++ b/src/liblzma/common/index.c +@@ -433,6 +433,26 @@ lzma_index_prealloc(lzma_index *i, lzma_vli records) + if (records > PREALLOC_MAX) + records = PREALLOC_MAX; + ++ // If index_decoder.c calls us with records == 0, it's decoding ++ // an Index that has no Records. In that case the decoder won't call ++ // lzma_index_append() at all, and i->prealloc isn't used during ++ // the Index decoding either. ++ // ++ // Normally the first lzma_index_append() call from the Index decoder ++ // would reset i->prealloc to INDEX_GROUP_SIZE. With no Records, ++ // lzma_index_append() isn't called and the resetting of prealloc ++ // won't occur either. Thus, if records == 0, use the default value ++ // INDEX_GROUP_SIZE instead. ++ // ++ // NOTE: lzma_index_append() assumes i->prealloc > 0. liblzma <= 5.8.2 ++ // didn't have this check and could set i->prealloc = 0, which would ++ // result in a buffer overflow if the application called ++ // lzma_index_append() after decoding an empty Index. Appending ++ // Records after decoding an Index is a rare thing to do, but ++ // it is supposed to work. ++ if (records == 0) ++ records = INDEX_GROUP_SIZE; ++ + i->prealloc = (size_t)(records); + return; + } +@@ -685,6 +705,7 @@ lzma_index_append(lzma_index *i, const lzma_allocator *allocator, + ++g->last; + } else { + // We need to allocate a new group. ++ assert(i->prealloc > 0); + g = lzma_alloc(sizeof(index_group) + + i->prealloc * sizeof(index_record), + allocator); +-- +2.47.3 +
package/xz/xz.mk +3 -0
@@ -24,6 +24,9 @@ HOST_XZ_ADD_CCACHE_DEPENDENCY = NO # 0004-liblzma-mt-dec-Don-t-modify-thr-in_size-in-the-worke.patch XZ_IGNORE_CVES = CVE-2025-31115 +# 0005-liblzma-Fix-a-buffer-overflow-in-lzma_index_append.patch +XZ_IGNORE_CVES += CVE-2026-34743 + XZ_CONF_OPTS = \ --enable-encoders=lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv \ --enable-decoders=lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv \
Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Peter,
Thanks for the submission I applied right now the following
https://lore.kernel.org/r/<[email protected]>
I think the patch is the same.
I tend to keep a small buffer for people to react to the patches I backport and apply myself. If you think security backport should be applied faster let me know.
Best regards,
PERALE Thomas
In reply of:
Quoted 123 lines
Fixes the following vulnerability:
CVE-2026-34743: XZ Utils: Buffer overflow in
lzma_index_append()If
lzma_index_decoder()was used to decode an Index that contained no Records, the resultinglzma_indexwas left in a state where where a subsequentlzma_index_append()would allocate too little memory, and a buffer overflow would occur.The
lzma_indexfunctions are rarely used by applications directly. In the few applications that do use these functions, the combination of function calls required to trigger this bug are unlikely to exist, because there typically is no reason to append Records to a decodedlzma_index. Thus, it's likely that this bug cannot be triggered in any real-world application.This bug is older than xz 5.0.0, so all stable releases are affected. The issue has been fixed in XZ Utils 5.8.3 and in the Git repository branch v5.8. The fix is also available in the Git repository branches v5.6, v5.4, and v5.2, but no new releases will be made from these old branches.
https://github.com/tukaani-project/xz/security/advisories/GHSA-x872-m794-cxhv
Signed-off-by Peter Korsgaard <[email protected]>--- ...buffer-overflow-in-lzma_index_append.patch | 66 +++++++++++++++++++ package/xz/xz.mk | 3 + 2 files changed, 69 insertions(+) create mode 100644 package/xz/0005-liblzma-Fix-a-buffer-overflow-in-lzma_index_append.patchpackage/xz/0005-liblzma-Fix-a-buffer-overflow-in-lzma_index_append.patch new file +66
-0@@ -0,0 +1,66 @@ +From 8287299ba858bd7ee767fe6eabcc050574616bf4 Mon Sep 17 00:00:00 2001 +From: Lasse Collin <[email protected]> +Date: Sun, 29 Mar 2026 19:11:21 +0300 +Subject: [PATCH] liblzma: Fix a buffer overflow in lzma_index_append() + +If lzma_index_decoder() was used to decode an Index that contained no +Records, the resulting lzma_index had an invalid internal "prealloc" +value. If lzma_index_append() was called on this lzma_index, too +little memory would be allocated and a buffer overflow would occur. + +While this combination of the API functions is meant to work, in the +real-world apps this call sequence is rare or might not exist at all. + +This bug is older than xz 5.0.0, so all stable releases are affected. + +Reported-by: GitHub user christos-spearbit +(cherry picked from commit c8c22869e780ff57c96b46939c3d79ff99395f87) +CVE: CVE-2026-34743 +Upstream: https://github.com/tukaani-project/xz/commit/8287299ba858bd7ee767fe6eabcc050574616bf4 +Signed-off-by: Peter Korsgaard <[email protected]> +--- + src/liblzma/common/index.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c +index 6add6a68..c4aadb9b 100644 +--- a/src/liblzma/common/index.c ++++ b/src/liblzma/common/index.c +@@ -433,6 +433,26 @@ lzma_index_prealloc(lzma_index *i, lzma_vli records) + if (records > PREALLOC_MAX) + records = PREALLOC_MAX; + ++ // If index_decoder.c calls us with records == 0, it's decoding ++ // an Index that has no Records. In that case the decoder won't call ++ // lzma_index_append() at all, and i->prealloc isn't used during ++ // the Index decoding either. ++ // ++ // Normally the first lzma_index_append() call from the Index decoder ++ // would reset i->prealloc to INDEX_GROUP_SIZE. With no Records, ++ // lzma_index_append() isn't called and the resetting of prealloc ++ // won't occur either. Thus, if records == 0, use the default value ++ // INDEX_GROUP_SIZE instead. ++ // ++ // NOTE: lzma_index_append() assumes i->prealloc > 0. liblzma <= 5.8.2 ++ // didn't have this check and could set i->prealloc = 0, which would ++ // result in a buffer overflow if the application called ++ // lzma_index_append() after decoding an empty Index. Appending ++ // Records after decoding an Index is a rare thing to do, but ++ // it is supposed to work. ++ if (records == 0) ++ records = INDEX_GROUP_SIZE; ++ + i->prealloc = (size_t)(records); + return; + } +@@ -685,6 +705,7 @@ lzma_index_append(lzma_index *i, const lzma_allocator *allocator, + ++g->last; + } else { + // We need to allocate a new group. ++ assert(i->prealloc > 0); + g = lzma_alloc(sizeof(index_group) + + i->prealloc * sizeof(index_record), + allocator); +-- +2.47.3 +package/xz/xz.mk +3
-0@@ -24,6 +24,9 @@ HOST_XZ_ADD_CCACHE_DEPENDENCY = NO # 0004-liblzma-mt-dec-Don-t-modify-thr-in_size-in-the-worke.patch XZ_IGNORE_CVES = CVE-2025-31115 +# 0005-liblzma-Fix-a-buffer-overflow-in-lzma_index_append.patch +XZ_IGNORE_CVES += CVE-2026-34743 + XZ_CONF_OPTS = \ --enable-encoders=lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv \ --enable-decoders=lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,arm64,sparc,riscv \Signature · 6 lines
2.47.3 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Perale <[email protected]> writes:
Hi Peter,
Thanks for the submission I applied right now the following
https://lore.kernel.org/r/<[email protected]>I think the patch is the same.
I tend to keep a small buffer for people to react to the patches I backport and apply myself. If you think security backport should be applied faster let me know.
Ahh, fine. I didn't see your patch in patchwork or on the 2025.02.x branch, which is why I sent it as well.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot