Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python for openSUSE:Factory checked in at 2023-12-05 17:02:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python (Old) and /work/SRC/openSUSE:Factory/.python.new.25432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python" Tue Dec 5 17:02:38 2023 rev:190 rq:1130832 version:2.7.18 Changes: -------- --- /work/SRC/openSUSE:Factory/python/python-base.changes 2023-11-28 22:18:50.804556114 +0100 +++ /work/SRC/openSUSE:Factory/.python.new.25432/python-base.changes 2023-12-05 17:02:57.964594376 +0100 @@ -2 +2,9 @@ -Sat Sep 30 11:43:49 UTC 2023 - Matej Cepl <[email protected]> +Mon Nov 27 16:30:33 UTC 2023 - Matej Cepl <[email protected]> + +- Add CVE-2022-48560-after-free-heappushpop.patch fixing + use-after-free in Python via heappushpop in heapq (bsc#1214675, + CVE-2022-48560). +- switch from %patchN style to the %patch -P N one. + +------------------------------------------------------------------- +Sat Sep 16 12:40:52 UTC 2023 - Matej Cepl <[email protected]> python-doc.changes: same change python.changes: same change New: ---- CVE-2022-48560-after-free-heappushpop.patch BETA DEBUG BEGIN: New:/work/SRC/openSUSE:Factory/.python.new.25432/python-base.changes- /work/SRC/openSUSE:Factory/.python.new.25432/python-base.changes:- Add CVE-2022-48560-after-free-heappushpop.patch fixing /work/SRC/openSUSE:Factory/.python.new.25432/python-base.changes- use-after-free in Python via heappushpop in heapq (bsc#1214675, -- /work/SRC/openSUSE:Factory/.python.new.25432/python-doc.changes- /work/SRC/openSUSE:Factory/.python.new.25432/python-doc.changes:- Add CVE-2022-48560-after-free-heappushpop.patch fixing /work/SRC/openSUSE:Factory/.python.new.25432/python-doc.changes- use-after-free in Python via heappushpop in heapq (bsc#1214675, -- /work/SRC/openSUSE:Factory/.python.new.25432/python.changes- /work/SRC/openSUSE:Factory/.python.new.25432/python.changes:- Add CVE-2022-48560-after-free-heappushpop.patch fixing /work/SRC/openSUSE:Factory/.python.new.25432/python.changes- use-after-free in Python via heappushpop in heapq (bsc#1214675, BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-base.spec ++++++ --- /var/tmp/diff_new_pack.IlgkDn/_old 2023-12-05 17:03:00.504688005 +0100 +++ /var/tmp/diff_new_pack.IlgkDn/_new 2023-12-05 17:03:00.508688152 +0100 @@ -161,6 +161,9 @@ # PATCH-FIX-UPSTREAM CVE-2022-48566-compare_digest-more-constant.patch bsc#1214691 [email protected] # Make compare_digest more constant-time Patch80: CVE-2022-48566-compare_digest-more-constant.patch +# PATCH-FIX-UPSTREAM CVE-2022-48560-after-free-heappushpop.patch bsc#1214675 [email protected] +# fix use after free in heapq.heappushpop() +Patch81: CVE-2022-48560-after-free-heappushpop.patch # COMMON-PATCH-END %define python_version %(echo %{tarversion} | head -c 3) BuildRequires: automake @@ -256,67 +259,68 @@ %setup -q -n %{tarname} # patching # COMMON-PREP-BEGIN -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch7 -p1 -%patch8 -p1 -%patch10 -p1 -%patch13 -p1 -%patch17 -p1 -%patch20 -p1 -%patch22 -p1 -%patch24 -p1 -%patch33 -p1 +%patch -P 1 -p1 +%patch -P 2 -p1 +%patch -P 3 -p1 +%patch -P 4 -p1 +%patch -P 5 -p1 +%patch -P 7 -p1 +%patch -P 8 -p1 +%patch -P 10 -p1 +%patch -P 13 -p1 +%patch -P 17 -p1 +%patch -P 20 -p1 +%patch -P 22 -p1 +%patch -P 24 -p1 +%patch -P 33 -p1 %if %{suse_version} < 1500 && !0%{?is_opensuse} -%patch34 -p1 +%patch -P 34 -p1 %endif -%patch35 -p1 -%patch38 -p1 +%patch -P 35 -p1 +%patch -P 38 -p1 %ifarch ppc ppc64 ppc64le -%patch40 -p1 +%patch -P 40 -p1 %endif -%patch41 -p1 +%patch -P 41 -p1 %if %{suse_version} >= 1500 || (0%{?sle_version} && 0%{?sle_version} >= 120400) -%patch47 -p1 -%patch48 -p1 +%patch -P 47 -p1 +%patch -P 48 -p1 %endif # SLE-12 needs to skip more %if %{suse_version} == 1315 -%patch57 -p1 +%patch -P 57 -p1 %endif -%patch49 -p1 -%patch50 -p1 -%patch51 -p1 -%patch55 -p1 -%patch56 -p1 -%patch58 -p1 -%patch59 -p1 -%patch60 -p1 -%patch61 -p1 -%patch62 -p1 -%patch63 -p1 -%patch64 -p1 -%patch65 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 -%patch70 -p1 -%patch71 -p1 -%patch72 -p1 -%patch73 -p1 +%patch -P 49 -p1 +%patch -P 50 -p1 +%patch -P 51 -p1 +%patch -P 55 -p1 +%patch -P 56 -p1 +%patch -P 58 -p1 +%patch -P 59 -p1 +%patch -P 60 -p1 +%patch -P 61 -p1 +%patch -P 62 -p1 +%patch -P 63 -p1 +%patch -P 64 -p1 +%patch -P 65 -p1 +%patch -P 66 -p1 +%patch -P 67 -p1 +%patch -P 68 -p1 +%patch -P 69 -p1 +%patch -P 70 -p1 +%patch -P 71 -p1 +%patch -P 72 -p1 +%patch -P 73 -p1 %if 0%{?sle_version} && 0%{?sle_version} < 150000 -%patch74 -p1 +%patch -P 74 -p1 %endif -%patch75 -p1 -%patch76 -p1 -# %%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 +%patch -P 75 -p1 +%patch -P 76 -p1 +# %%patch -P 77 -p1 +%patch -P 78 -p1 +%patch -P 79 -p1 +%patch -P 80 -p1 +%patch -P 81 -p1 # For patch 66 cp -v %{SOURCE66} Lib/test/recursion.tar ++++++ python-doc.spec ++++++ --- /var/tmp/diff_new_pack.IlgkDn/_old 2023-12-05 17:03:00.532689037 +0100 +++ /var/tmp/diff_new_pack.IlgkDn/_new 2023-12-05 17:03:00.532689037 +0100 @@ -160,6 +160,9 @@ # PATCH-FIX-UPSTREAM CVE-2022-48566-compare_digest-more-constant.patch bsc#1214691 [email protected] # Make compare_digest more constant-time Patch80: CVE-2022-48566-compare_digest-more-constant.patch +# PATCH-FIX-UPSTREAM CVE-2022-48560-after-free-heappushpop.patch bsc#1214675 [email protected] +# fix use after free in heapq.heappushpop() +Patch81: CVE-2022-48560-after-free-heappushpop.patch # COMMON-PATCH-END Provides: pyth_doc = %{version} Provides: pyth_ps = %{version} @@ -190,67 +193,68 @@ %prep %setup -q -n %{tarname} # COMMON-PREP-BEGIN -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch7 -p1 -%patch8 -p1 -%patch10 -p1 -%patch13 -p1 -%patch17 -p1 -%patch20 -p1 -%patch22 -p1 -%patch24 -p1 -%patch33 -p1 +%patch -P 1 -p1 +%patch -P 2 -p1 +%patch -P 3 -p1 +%patch -P 4 -p1 +%patch -P 5 -p1 +%patch -P 7 -p1 +%patch -P 8 -p1 +%patch -P 10 -p1 +%patch -P 13 -p1 +%patch -P 17 -p1 +%patch -P 20 -p1 +%patch -P 22 -p1 +%patch -P 24 -p1 +%patch -P 33 -p1 %if %{suse_version} < 1500 && !0%{?is_opensuse} -%patch34 -p1 +%patch -P 34 -p1 %endif -%patch35 -p1 -%patch38 -p1 +%patch -P 35 -p1 +%patch -P 38 -p1 %ifarch ppc ppc64 ppc64le -%patch40 -p1 +%patch -P 40 -p1 %endif -%patch41 -p1 +%patch -P 41 -p1 %if %{suse_version} >= 1500 || (0%{?sle_version} && 0%{?sle_version} >= 120400) -%patch47 -p1 -%patch48 -p1 +%patch -P 47 -p1 +%patch -P 48 -p1 %endif # SLE-12 needs to skip more %if %{suse_version} == 1315 -%patch57 -p1 +%patch -P 57 -p1 %endif -%patch49 -p1 -%patch50 -p1 -%patch51 -p1 -%patch55 -p1 -%patch56 -p1 -%patch58 -p1 -%patch59 -p1 -%patch60 -p1 -%patch61 -p1 -%patch62 -p1 -%patch63 -p1 -%patch64 -p1 -%patch65 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 -%patch70 -p1 -%patch71 -p1 -%patch72 -p1 -%patch73 -p1 +%patch -P 49 -p1 +%patch -P 50 -p1 +%patch -P 51 -p1 +%patch -P 55 -p1 +%patch -P 56 -p1 +%patch -P 58 -p1 +%patch -P 59 -p1 +%patch -P 60 -p1 +%patch -P 61 -p1 +%patch -P 62 -p1 +%patch -P 63 -p1 +%patch -P 64 -p1 +%patch -P 65 -p1 +%patch -P 66 -p1 +%patch -P 67 -p1 +%patch -P 68 -p1 +%patch -P 69 -p1 +%patch -P 70 -p1 +%patch -P 71 -p1 +%patch -P 72 -p1 +%patch -P 73 -p1 %if 0%{?sle_version} && 0%{?sle_version} < 150000 -%patch74 -p1 +%patch -P 74 -p1 %endif -%patch75 -p1 -%patch76 -p1 -# %%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 +%patch -P 75 -p1 +%patch -P 76 -p1 +# %%patch -P 77 -p1 +%patch -P 78 -p1 +%patch -P 79 -p1 +%patch -P 80 -p1 +%patch -P 81 -p1 # For patch 66 cp -v %{SOURCE66} Lib/test/recursion.tar ++++++ python.spec ++++++ --- /var/tmp/diff_new_pack.IlgkDn/_old 2023-12-05 17:03:00.556689921 +0100 +++ /var/tmp/diff_new_pack.IlgkDn/_new 2023-12-05 17:03:00.560690069 +0100 @@ -160,6 +160,9 @@ # PATCH-FIX-UPSTREAM CVE-2022-48566-compare_digest-more-constant.patch bsc#1214691 [email protected] # Make compare_digest more constant-time Patch80: CVE-2022-48566-compare_digest-more-constant.patch +# PATCH-FIX-UPSTREAM CVE-2022-48560-after-free-heappushpop.patch bsc#1214675 [email protected] +# fix use after free in heapq.heappushpop() +Patch81: CVE-2022-48560-after-free-heappushpop.patch # COMMON-PATCH-END BuildRequires: automake BuildRequires: db-devel @@ -310,67 +313,68 @@ %prep %setup -q -n %{tarname} # COMMON-PREP-BEGIN -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch7 -p1 -%patch8 -p1 -%patch10 -p1 -%patch13 -p1 -%patch17 -p1 -%patch20 -p1 -%patch22 -p1 -%patch24 -p1 -%patch33 -p1 +%patch -P 1 -p1 +%patch -P 2 -p1 +%patch -P 3 -p1 +%patch -P 4 -p1 +%patch -P 5 -p1 +%patch -P 7 -p1 +%patch -P 8 -p1 +%patch -P 10 -p1 +%patch -P 13 -p1 +%patch -P 17 -p1 +%patch -P 20 -p1 +%patch -P 22 -p1 +%patch -P 24 -p1 +%patch -P 33 -p1 %if %{suse_version} < 1500 && !0%{?is_opensuse} -%patch34 -p1 +%patch -P 34 -p1 %endif -%patch35 -p1 -%patch38 -p1 +%patch -P 35 -p1 +%patch -P 38 -p1 %ifarch ppc ppc64 ppc64le -%patch40 -p1 +%patch -P 40 -p1 %endif -%patch41 -p1 +%patch -P 41 -p1 %if %{suse_version} >= 1500 || (0%{?sle_version} && 0%{?sle_version} >= 120400) -%patch47 -p1 -%patch48 -p1 +%patch -P 47 -p1 +%patch -P 48 -p1 %endif # SLE-12 needs to skip more %if %{suse_version} == 1315 -%patch57 -p1 +%patch -P 57 -p1 %endif -%patch49 -p1 -%patch50 -p1 -%patch51 -p1 -%patch55 -p1 -%patch56 -p1 -%patch58 -p1 -%patch59 -p1 -%patch60 -p1 -%patch61 -p1 -%patch62 -p1 -%patch63 -p1 -%patch64 -p1 -%patch65 -p1 -%patch66 -p1 -%patch67 -p1 -%patch68 -p1 -%patch69 -p1 -%patch70 -p1 -%patch71 -p1 -%patch72 -p1 -%patch73 -p1 +%patch -P 49 -p1 +%patch -P 50 -p1 +%patch -P 51 -p1 +%patch -P 55 -p1 +%patch -P 56 -p1 +%patch -P 58 -p1 +%patch -P 59 -p1 +%patch -P 60 -p1 +%patch -P 61 -p1 +%patch -P 62 -p1 +%patch -P 63 -p1 +%patch -P 64 -p1 +%patch -P 65 -p1 +%patch -P 66 -p1 +%patch -P 67 -p1 +%patch -P 68 -p1 +%patch -P 69 -p1 +%patch -P 70 -p1 +%patch -P 71 -p1 +%patch -P 72 -p1 +%patch -P 73 -p1 %if 0%{?sle_version} && 0%{?sle_version} < 150000 -%patch74 -p1 +%patch -P 74 -p1 %endif -%patch75 -p1 -%patch76 -p1 -# %%patch77 -p1 -%patch78 -p1 -%patch79 -p1 -%patch80 -p1 +%patch -P 75 -p1 +%patch -P 76 -p1 +# %%patch -P 77 -p1 +%patch -P 78 -p1 +%patch -P 79 -p1 +%patch -P 80 -p1 +%patch -P 81 -p1 # For patch 66 cp -v %{SOURCE66} Lib/test/recursion.tar ++++++ CVE-2022-48560-after-free-heappushpop.patch ++++++ >From 5179d30710e6185dc7e6a6098ab23fe068b0d85b Mon Sep 17 00:00:00 2001 From: Lumir Balhar <[email protected]> Date: Thu, 23 Nov 2023 13:25:44 +0100 Subject: [PATCH] 00408-cve-2022-48560.patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Security fix for CVE-2022-48560: python3: use after free in heappushpop() of heapq module Resolved upstream: https://github.com/python/cpython/issues/83602 Backported from Python 3.6.11. Co-authored-by: Pablo Galindo <[email protected]> Co-authored-by: LumÃr Balhar <[email protected]> --- Lib/test/test_heapq.py | 32 ++++++++++++++++++++++++++++++++ Modules/_heapqmodule.c | 31 ++++++++++++++++++++++++------- 2 files changed, 56 insertions(+), 7 deletions(-) --- a/Lib/test/test_heapq.py +++ b/Lib/test/test_heapq.py @@ -396,6 +396,38 @@ class TestErrorHandling(TestCase): with self.assertRaises((IndexError, RuntimeError)): self.module.heappop(heap) + def test_comparison_operator_modifiying_heap(self): + # See bpo-39421: Strong references need to be taken + # when comparing objects as they can alter the heap + class EvilClass(int): + def __lt__(self, o): + heap[:] = [] + return NotImplemented + + heap = [] + self.module.heappush(heap, EvilClass(0)) + self.assertRaises(IndexError, self.module.heappushpop, heap, 1) + + def test_comparison_operator_modifiying_heap_two_heaps(self): + + class h(int): + def __lt__(self, o): + list2[:] = [] + return NotImplemented + + class g(int): + def __lt__(self, o): + list1[:] = [] + return NotImplemented + + list1, list2 = [], [] + + self.module.heappush(list1, h(0)) + self.module.heappush(list2, g(0)) + + self.assertRaises((IndexError, RuntimeError), self.module.heappush, list1, g(1)) + self.assertRaises((IndexError, RuntimeError), self.module.heappush, list2, h(1)) + class TestErrorHandlingPython(TestErrorHandling): module = py_heapq --- a/Modules/_heapqmodule.c +++ b/Modules/_heapqmodule.c @@ -52,7 +52,11 @@ _siftdown(PyListObject *heap, Py_ssize_t while (pos > startpos) { parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); + Py_INCREF(newitem); + Py_INCREF(parent); cmp = cmp_lt(newitem, parent); + Py_DECREF(parent); + Py_DECREF(newitem); if (cmp == -1) return -1; if (size != PyList_GET_SIZE(heap)) { @@ -93,9 +97,13 @@ _siftup(PyListObject *heap, Py_ssize_t p childpos = 2*pos + 1; /* leftmost child position */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = cmp_lt( - PyList_GET_ITEM(heap, childpos), - PyList_GET_ITEM(heap, rightpos)); + PyObject* a = PyList_GET_ITEM(heap, childpos); + PyObject* b = PyList_GET_ITEM(heap, rightpos); + Py_INCREF(a); + Py_INCREF(b); + cmp = cmp_lt(a, b); + Py_DECREF(a); + Py_DECREF(b); if (cmp == -1) return -1; if (cmp == 0) @@ -236,7 +244,10 @@ heappushpop(PyObject *self, PyObject *ar return item; } - cmp = cmp_lt(PyList_GET_ITEM(heap, 0), item); + PyObject* top = PyList_GET_ITEM(heap, 0); + Py_INCREF(top); + cmp = cmp_lt(top, item); + Py_DECREF(top); if (cmp == -1) return NULL; if (cmp == 0) { @@ -395,7 +406,9 @@ _siftdownmax(PyListObject *heap, Py_ssiz while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); + Py_INCREF(parent); cmp = cmp_lt(parent, newitem); + Py_DECREF(parent); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -436,9 +449,13 @@ _siftupmax(PyListObject *heap, Py_ssize_ childpos = 2*pos + 1; /* leftmost child position */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = cmp_lt( - PyList_GET_ITEM(heap, rightpos), - PyList_GET_ITEM(heap, childpos)); + PyObject* a = PyList_GET_ITEM(heap, rightpos); + PyObject* b = PyList_GET_ITEM(heap, childpos); + Py_INCREF(a); + Py_INCREF(b); + cmp = cmp_lt(a, b); + Py_DECREF(a); + Py_DECREF(b); if (cmp == -1) { Py_DECREF(newitem); return -1;
