49 lines
1.8 KiB
Diff
49 lines
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Stan Ulbrych <stan@python.org>
|
|
Date: Mon, 13 Apr 2026 22:42:36 +0100
|
|
Subject: 00482: CVE-2026-6100
|
|
|
|
Fix a possible UAF in {LZMA,BZ2,_Zlib}Decompressor
|
|
---
|
|
.../Security/2026-04-10-16-28-21.gh-issue-148395.kfzm0G.rst | 5 +++++
|
|
Modules/_bz2module.c | 1 +
|
|
Modules/_lzmamodule.c | 1 +
|
|
3 files changed, 7 insertions(+)
|
|
create mode 100644 Misc/NEWS.d/next/Security/2026-04-10-16-28-21.gh-issue-148395.kfzm0G.rst
|
|
|
|
diff --git a/Misc/NEWS.d/next/Security/2026-04-10-16-28-21.gh-issue-148395.kfzm0G.rst b/Misc/NEWS.d/next/Security/2026-04-10-16-28-21.gh-issue-148395.kfzm0G.rst
|
|
new file mode 100644
|
|
index 0000000000..349d1cf3ca
|
|
--- /dev/null
|
|
+++ b/Misc/NEWS.d/next/Security/2026-04-10-16-28-21.gh-issue-148395.kfzm0G.rst
|
|
@@ -0,0 +1,5 @@
|
|
+Fix a dangling input pointer in :class:`lzma.LZMADecompressor`,
|
|
+and :class:`bz2.BZ2Decompressor`
|
|
+when memory allocation fails with :exc:`MemoryError`, which could let a
|
|
+subsequent :meth:`!decompress` call read or write through a stale pointer to
|
|
+the already-released caller buffer.
|
|
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
|
|
index 798e9efc62..b08ac5e44e 100644
|
|
--- a/Modules/_bz2module.c
|
|
+++ b/Modules/_bz2module.c
|
|
@@ -595,6 +595,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len, Py_ssize_t max_length)
|
|
return result;
|
|
|
|
error:
|
|
+ bzs->next_in = NULL;
|
|
Py_XDECREF(result);
|
|
return NULL;
|
|
}
|
|
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
|
|
index 97453a2808..51106a6a07 100644
|
|
--- a/Modules/_lzmamodule.c
|
|
+++ b/Modules/_lzmamodule.c
|
|
@@ -1105,6 +1105,7 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length)
|
|
return result;
|
|
|
|
error:
|
|
+ lzs->next_in = NULL;
|
|
Py_XDECREF(result);
|
|
return NULL;
|
|
}
|