summaryrefslogtreecommitdiffstats
path: root/meta-python
diff options
context:
space:
mode:
Diffstat (limited to 'meta-python')
-rw-r--r--meta-python/recipes-devtools/python/python3-tqdm/CVE-2024-34062.patch64
-rw-r--r--meta-python/recipes-devtools/python/python3-tqdm_4.64.0.bb1
2 files changed, 65 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-tqdm/CVE-2024-34062.patch b/meta-python/recipes-devtools/python/python3-tqdm/CVE-2024-34062.patch
new file mode 100644
index 0000000000..a4aaf6248b
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-tqdm/CVE-2024-34062.patch
@@ -0,0 +1,64 @@
1From 35f8daf26d28950aa44a763f19a13c6ee133ff6c Mon Sep 17 00:00:00 2001
2From: Casper da Costa-Luis <tqdm@cdcl.ml>
3Date: Wed, 1 May 2024 14:56:01 +0100
4Subject: [PATCH] cli: eval safety
5
6- fixes GHSA-g7vv-2v7x-gj9p
7
8CVE: CVE-2024-34062
9Upstream-Status: Backport [https://github.com/tqdm/tqdm/commit/4e613f84ed2ae029559f539464df83fa91feb316]
10Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
11---
12 tqdm/cli.py | 33 ++++++++++++++++++++++-----------
13 1 file changed, 22 insertions(+), 11 deletions(-)
14
15diff --git a/tqdm/cli.py b/tqdm/cli.py
16index 3ed25fb..e4f587b 100644
17--- a/tqdm/cli.py
18+++ b/tqdm/cli.py
19@@ -21,23 +21,34 @@ def cast(val, typ):
20 return cast(val, t)
21 except TqdmTypeError:
22 pass
23- raise TqdmTypeError(val + ' : ' + typ)
24+ raise TqdmTypeError(f"{val} : {typ}")
25
26 # sys.stderr.write('\ndebug | `val:type`: `' + val + ':' + typ + '`.\n')
27 if typ == 'bool':
28 if (val == 'True') or (val == ''):
29 return True
30- elif val == 'False':
31+ if val == 'False':
32 return False
33- else:
34- raise TqdmTypeError(val + ' : ' + typ)
35- try:
36- return eval(typ + '("' + val + '")')
37- except Exception:
38- if typ == 'chr':
39- return chr(ord(eval('"' + val + '"'))).encode()
40- else:
41- raise TqdmTypeError(val + ' : ' + typ)
42+ raise TqdmTypeError(val + ' : ' + typ)
43+ if typ == 'chr':
44+ if len(val) == 1:
45+ return val.encode()
46+ if re.match(r"^\\\w+$", val):
47+ return eval(f'"{val}"').encode()
48+ raise TqdmTypeError(f"{val} : {typ}")
49+ if typ == 'str':
50+ return val
51+ if typ == 'int':
52+ try:
53+ return int(val)
54+ except ValueError as exc:
55+ raise TqdmTypeError(f"{val} : {typ}") from exc
56+ if typ == 'float':
57+ try:
58+ return float(val)
59+ except ValueError as exc:
60+ raise TqdmTypeError(f"{val} : {typ}") from exc
61+ raise TqdmTypeError(f"{val} : {typ}")
62
63
64 def posix_pipe(fin, fout, delim=b'\\n', buf_size=256,
diff --git a/meta-python/recipes-devtools/python/python3-tqdm_4.64.0.bb b/meta-python/recipes-devtools/python/python3-tqdm_4.64.0.bb
index 3cb45f1a6e..5533b34d25 100644
--- a/meta-python/recipes-devtools/python/python3-tqdm_4.64.0.bb
+++ b/meta-python/recipes-devtools/python/python3-tqdm_4.64.0.bb
@@ -5,6 +5,7 @@ SECTION = "devel/python"
5LICENSE = "MIT & MPL-2.0" 5LICENSE = "MIT & MPL-2.0"
6LIC_FILES_CHKSUM = "file://LICENCE;md5=1672e2674934fd93a31c09cf17f34100" 6LIC_FILES_CHKSUM = "file://LICENCE;md5=1672e2674934fd93a31c09cf17f34100"
7 7
8SRC_URI += "file://CVE-2024-34062.patch"
8SRC_URI[sha256sum] = "40be55d30e200777a307a7585aee69e4eabb46b4ec6a4b4a5f2d9f11e7d5408d" 9SRC_URI[sha256sum] = "40be55d30e200777a307a7585aee69e4eabb46b4ec6a4b4a5f2d9f11e7d5408d"
9 10
10inherit pypi python_setuptools_build_meta 11inherit pypi python_setuptools_build_meta