diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2026-01-06 08:33:29 +0100 |
|---|---|---|
| committer | Gyorgy Sarvari <skandigraun@gmail.com> | 2026-01-08 22:03:03 +0100 |
| commit | 2adb3d6734b9ea6050b9e6c39ddf58da8c18e2ad (patch) | |
| tree | d97c1fe320e6a56344db5c0bb6b3cb84c4e6538b /meta-python/recipes-devtools | |
| parent | 304c0c66430e6aee14793016d9b2236f577de771 (diff) | |
| download | meta-openembedded-2adb3d6734b9ea6050b9e6c39ddf58da8c18e2ad.tar.gz | |
python3-mpmath: patch CVE-2021-29063
Details: https://nvd.nist.gov/vuln/detail/CVE-2021-29063
Pick the patch referenced by the NVD advisory.
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-mpmath/CVE-2021-29063.patch | 51 | ||||
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-mpmath_1.2.1.bb | 1 |
2 files changed, 52 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-mpmath/CVE-2021-29063.patch b/meta-python/recipes-devtools/python/python3-mpmath/CVE-2021-29063.patch new file mode 100644 index 0000000000..3674a32ea1 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-mpmath/CVE-2021-29063.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 2e196ba7e41a46b8cafa5971e559ca55171414dc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vinzent Steinberg <Vinzent.Steinberg@gmail.com> | ||
| 3 | Date: Wed, 10 Feb 2021 16:45:04 +0100 | ||
| 4 | Subject: [PATCH] Fix ReDOS vulnerability | ||
| 5 | |||
| 6 | Fixes #548, with the workaround suggested by @yetingli. | ||
| 7 | |||
| 8 | CVE: CVE-2021-29063 | ||
| 9 | Upstream-Status: Backport [https://github.com/mpmath/mpmath/commit/46d44c3c8f3244017fe1eb102d564eb4ab8ef750] | ||
| 10 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 11 | --- | ||
| 12 | mpmath/ctx_mp.py | 4 ++-- | ||
| 13 | mpmath/tests/test_convert.py | 10 ++++++++++ | ||
| 14 | 2 files changed, 12 insertions(+), 2 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/mpmath/ctx_mp.py b/mpmath/ctx_mp.py | ||
| 17 | index 39fc941..93594dd 100644 | ||
| 18 | --- a/mpmath/ctx_mp.py | ||
| 19 | +++ b/mpmath/ctx_mp.py | ||
| 20 | @@ -42,8 +42,8 @@ | ||
| 21 | |||
| 22 | new = object.__new__ | ||
| 23 | |||
| 24 | -get_complex = re.compile(r'^\(?(?P<re>[\+\-]?\d*\.?\d*(e[\+\-]?\d+)?)??' | ||
| 25 | - r'(?P<im>[\+\-]?\d*\.?\d*(e[\+\-]?\d+)?j)?\)?$') | ||
| 26 | +get_complex = re.compile(r'^\(?(?P<re>[\+\-]?\d*(\.\d*)?(e[\+\-]?\d+)?)??' | ||
| 27 | + r'(?P<im>[\+\-]?\d*(\.\d*)?(e[\+\-]?\d+)?j)?\)?$') | ||
| 28 | |||
| 29 | if BACKEND == 'sage': | ||
| 30 | from sage.libs.mpmath.ext_main import Context as BaseMPContext | ||
| 31 | diff --git a/mpmath/tests/test_convert.py b/mpmath/tests/test_convert.py | ||
| 32 | index 3e2f555..cf1a91d 100644 | ||
| 33 | --- a/mpmath/tests/test_convert.py | ||
| 34 | +++ b/mpmath/tests/test_convert.py | ||
| 35 | @@ -194,6 +194,16 @@ def test_mpmathify(): | ||
| 36 | assert mpmathify('(1.2e-10 - 3.4e5j)') == mpc('1.2e-10', '-3.4e5') | ||
| 37 | assert mpmathify('1j') == mpc(1j) | ||
| 38 | |||
| 39 | +def test_issue548(): | ||
| 40 | + try: | ||
| 41 | + # This expression is invalid, but may trigger the ReDOS vulnerability | ||
| 42 | + # in the regular expression. | ||
| 43 | + mpmathify('(' + '1' * 5000 + '!j') | ||
| 44 | + except: | ||
| 45 | + return | ||
| 46 | + # The expression is invalid and should raise an exception. | ||
| 47 | + assert False | ||
| 48 | + | ||
| 49 | def test_compatibility(): | ||
| 50 | try: | ||
| 51 | import numpy as np | ||
diff --git a/meta-python/recipes-devtools/python/python3-mpmath_1.2.1.bb b/meta-python/recipes-devtools/python/python3-mpmath_1.2.1.bb index 3337df4903..bf883e0e9f 100644 --- a/meta-python/recipes-devtools/python/python3-mpmath_1.2.1.bb +++ b/meta-python/recipes-devtools/python/python3-mpmath_1.2.1.bb | |||
| @@ -6,6 +6,7 @@ HOMEPAGE = "https://pypi.org/project/mpmath/" | |||
| 6 | LICENSE = "BSD-3-Clause" | 6 | LICENSE = "BSD-3-Clause" |
| 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=71970bd3749eebe1bfef9f1efff5b37a" | 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=71970bd3749eebe1bfef9f1efff5b37a" |
| 8 | 8 | ||
| 9 | SRC_URI += "file://CVE-2021-29063.patch" | ||
| 9 | SRC_URI[sha256sum] = "79ffb45cf9f4b101a807595bcb3e72e0396202e0b1d25d689134b48c4216a81a" | 10 | SRC_URI[sha256sum] = "79ffb45cf9f4b101a807595bcb3e72e0396202e0b1d25d689134b48c4216a81a" |
| 10 | 11 | ||
| 11 | inherit pypi setuptools3 | 12 | inherit pypi setuptools3 |
