python2: fix segmentation fault in ptest test_bigrepeat
PATCH 1/1 python2: fix segmentation fault in ptest test_bigrepeat
Segmentation fault at case test_bigrepeat of python ptest. a similar bug can be found at https://bugs.python.org/issue33153.
tuplerepeat() in Objects/tupleobject.c uses a questionable check that relies on signed integer overflow. A singed integer overflow is triggered by ptest case: test_bigrepeat.
Python2 is out of maintainus, so backport the related patch from python3 commit:
https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5b
--- ...segmentation-fault-in-test_bigrepeat.patch | 33 +++++++++++++++++++ meta/recipes-devtools/python/python_2.7.18.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-devtools/python/python/0001-python2-fix-segmentation-fault-in-test_bigrepeat.patch
meta/recipes-devtools/python/python/0001-python2-fix-segmentation-fault-in-test_bigrepeat.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 031d06e1e670d40b6500cce4134ab35ec8858a8b Mon Sep 17 00:00:00 2001 +From: Heng Guo <[email protected]> +Date: Wed, 15 Jul 2020 15:42:13 +0800 +Subject: [PATCH] python2: fix segmentation fault in test_bigrepeat + +Port from: +https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5b +Only merge codes related to tuplerepeat() in tupleobject.c. + +Signed-off-by: Heng Guo <[email protected]> +--- + Objects/tupleobject.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c +index 6f4b18c..0b3cf64 100644 +--- a/Objects/tupleobject.c ++++ b/Objects/tupleobject.c +@@ -487,9 +487,9 @@ tuplerepeat(PyTupleObject *a, Py_ssize_t n) + if (Py_SIZE(a) == 0) + return PyTuple_New(0); + } +- size = Py_SIZE(a) * n; +- if (size/Py_SIZE(a) != n) ++ if (n > PY_SSIZE_T_MAX / Py_SIZE(a)) + return PyErr_NoMemory(); ++ size = Py_SIZE(a) * n; + np = (PyTupleObject *) PyTuple_New(size); + if (np == NULL) + return NULL; +-- +2.26.1 +
meta/recipes-devtools/python/python_2.7.18.bb +1 -0
@@ -30,6 +30,7 @@ SRC_URI += " \ file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \ file://float-endian.patch \ file://0001-python2-use-cc_basename-to-replace-CC-for-checking-c.patch \ + file://0001-python2-fix-segmentation-fault-in-test_bigrepeat.patch \ " S = "${WORKDIR}/Python-${PV}"
Signature · 1 line
2.26.1
Quoted 41 lines · Heng Guo
Segmentation fault at case
test_bigrepeatof python ptest. a similar bug
can be found at https://bugs.python.org/issue33153.
tuplerepeat()inObjects/tupleobject.cuses a questionable check that relies on signed integer overflow. A singed integer overflow is triggered by ptest case:test_bigrepeat.Python2 is out of maintainus, so backport the related patch from python3
commit:
https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5bSigned-off-by Heng Guo <[email protected]>--- ...segmentation-fault-in-test_bigrepeat.patch | 33 +++++++++++++++++++ meta/recipes-devtools/python/python_2.7.18.bb | 1 + 2 files changed, 34 insertions(+) create mode 100644 meta/recipes-devtools/python/python/0001-python2-fix-segmentation-fault-in-test_bigrepeat.patch
(quoted diff) +0
-0segmentation-fault-in-test_bigrepeat.patch b/meta/recipes- devtools/python/python/0001-python2-fix-segmentation-fault-in- test_bigrepeat.patch
new file mode 100644
index 0000000000..45087bfb8dmeta/recipes-devtools/python/python/0001-python2-fix- new file +0
-0segmentation-fault-in-test_bigrepeat.patch
meta/recipes-devtools/python/python/0001-python2-fix- new file +1
-0@@ -0,0 +1,33 @@ +From 031d06e1e670d40b6500cce4134ab35ec8858a8b Mon Sep 17 00:00:002001
meta/recipes-devtools/python/python/0001-python2-fix- new file +6
-0+From: Heng Guo <[email protected]> +Date: Wed, 15 Jul 2020 15:42:13 +0800 +Subject: [PATCH] python2: fix segmentation fault in test_bigrepeat + +Port from: +https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5b
meta/recipes-devtools/python/python/0001-python2-fix-
Quoted 3 lines
meta/recipes-devtools/python/python/0001-python2-fix- new file +3
-0+Only merge codes related to tuplerepeat() in tupleobject.c. + +Signed-off-by: Heng Guo <[email protected]>
Missing Upstream-Status tag, also which branch is this against? The recipe no longer exists in OE-Core.
Cheers,
Richard
Quoted 40 lines · Richard Purdie
Quoted 39 lines · Heng Guo
Segmentation fault at case
test_bigrepeatof python ptest. a similar bug
can be found at https://bugs.python.org/issue33153.
tuplerepeat()inObjects/tupleobject.cuses a questionable check that relies on signed integer overflow. A singed integer overflow is triggered by ptest case:test_bigrepeat.Python2 is out of maintainus, so backport the related patch from python3
commit:
https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5bSigned-off-by Heng Guo <[email protected]>--- ...segmentation-fault-in-test_bigrepeat.patch | 33 +++++++++++++++++++ meta/recipes-devtools/python/python_2.7.18.bb | 1 + 2 files changed, 34 insertions(+)create mode 100644 meta/recipes-devtools/python/python/0001-python2-
fix-segmentation-fault-in-test_bigrepeat.patch(quoted diff) +0
-0segmentation-fault-in-test_bigrepeat.patch b/meta/recipes- devtools/python/python/0001-python2-fix-segmentation-fault-in- test_bigrepeat.patch
new file mode 100644
index 0000000000..45087bfb8dmeta/recipes-devtools/python/python/0001-python2-fix- new file +0
-0segmentation-fault-in-test_bigrepeat.patch
meta/recipes-devtools/python/python/0001-python2-fix- new file +1
-0@@ -0,0 +1,33 @@ +From 031d06e1e670d40b6500cce4134ab35ec8858a8b Mon Sep 17 00:00:002001
meta/recipes-devtools/python/python/0001-python2-fix- new file +5
-0+From: Heng Guo <[email protected]> +Date: Wed, 15 Jul 2020 15:42:13 +0800 +Subject: [PATCH] python2: fix segmentation fault in test_bigrepeat + +Port from:
Quoted 8 lines
meta/recipes-devtools/python/python/0001-python2-fix-
Quoted 5 lines
+
https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5bmeta/recipes-devtools/python/python/0001-python2-fix- new file +3
-0+Only merge codes related to tuplerepeat() in tupleobject.c. + +Signed-off-by: Heng Guo <[email protected]>Missing Upstream-Status tag, also which branch is this against? The recipe no longer exists in OE-Core.
[Heng]: https://bugs.python.org/issue33153 the same bug is reported to python2 over 2 years and on hold over 1 year. For python branch: remotes/origin/2.7.
Quoted 5 lines
Cheers,
Richard
Hi Richard,
The patch is for zeus branch.
Thanks,
Heng
Quoted 61 lines · heng guo
Quoted 44 lines · Richard Purdie
Quoted 43 lines · Heng Guo
Segmentation fault at case
test_bigrepeatof python ptest. a similar bug
can be found at https://bugs.python.org/issue33153.
tuplerepeat()inObjects/tupleobject.cuses a questionable check that relies on signed integer overflow. A singed integer overflow is triggered by ptest case:test_bigrepeat.Python2 is out of maintainus, so backport the related patch from python3
commit:
https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5bSigned-off-by Heng Guo <[email protected]>---
...segmentation-fault-in-test_bigrepeat.patch | 33
+++++++++++++++++++
meta/recipes-devtools/python/python_2.7.18.bb | 1 +2 files changed, 34 insertions(+)create mode 100644 meta/recipes-devtools/python/python/0001-python2- fix-segmentation-fault-in-test_bigrepeat.patch
(quoted diff) +0
-0segmentation-fault-in-test_bigrepeat.patch b/meta/recipes- devtools/python/python/0001-python2-fix-segmentation-fault-in- test_bigrepeat.patch
new file mode 100644
index 0000000000..45087bfb8dmeta/recipes-devtools/python/python/0001-python2-fix- new file +0
-0segmentation-fault-in-test_bigrepeat.patch
meta/recipes-devtools/python/python/0001-python2-fix- new file +1
-0@@ -0,0 +1,33 @@ +From 031d06e1e670d40b6500cce4134ab35ec8858a8b Mon Sep 17 00:00:002001
meta/recipes-devtools/python/python/0001-python2-fix- new file +6
-0+From: Heng Guo <[email protected]> +Date: Wed, 15 Jul 2020 15:42:13 +0800 +Subject: [PATCH] python2: fix segmentation fault in test_bigrepeat + +Port from: +https://github.com/python/cpython/commit/c04ddff290fc203d05b75c8569b748525fb76b5b
Quoted 6 lines
meta/recipes-devtools/python/python/0001-python2-fix-
Quoted 3 lines
meta/recipes-devtools/python/python/0001-python2-fix- new file +3
-0+Only merge codes related to tuplerepeat() in tupleobject.c. + +Signed-off-by: Heng Guo <[email protected]>Missing Upstream-Status tag, also which branch is this against? The recipe no longer exists in OE-Core.
[Heng]: https://bugs.python.org/issue33153 the same bug is reported to python2 over 2 years and on hold over 1 year. For python branch: remotes/origin/2.7.
Quoted 5 lines
Cheers,
Richard