diff options
| author | Gyorgy Sarvari <skandigraun@gmail.com> | 2026-01-30 08:06:18 +0100 |
|---|---|---|
| committer | Gyorgy Sarvari <skandigraun@gmail.com> | 2026-01-30 18:59:29 +0100 |
| commit | 0f26b38ebc7ba5239530402154af350dfd3f399f (patch) | |
| tree | 8cbc9bfced91c9bc32845472390c10c5c2a09a8b /meta-python/recipes-devtools/python | |
| parent | c40873cb69bf711aff84d61047c9022b4ccbabbd (diff) | |
| download | meta-openembedded-0f26b38ebc7ba5239530402154af350dfd3f399f.tar.gz | |
python3-pymongo: patch CVE-2024-5629
Details: https://nvd.nist.gov/vuln/detail/CVE-2024-5629
Backport the patch that is indicated to solve the issue based on the
upstream project's Jira ticket[1] (which comes from the NVD report).
[1]: https://jira.mongodb.org/browse/PYTHON-4305
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python')
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-pymongo/CVE-2024-5629.patch | 49 | ||||
| -rw-r--r-- | meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb | 1 |
2 files changed, 50 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pymongo/CVE-2024-5629.patch b/meta-python/recipes-devtools/python/python3-pymongo/CVE-2024-5629.patch new file mode 100644 index 0000000000..0b0822a756 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pymongo/CVE-2024-5629.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From a9454ae060fffa609cc02b129441679b7d248d8f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Shane Harvey <shnhrv@gmail.com> | ||
| 3 | Date: Wed, 27 Mar 2024 16:51:23 -0700 | ||
| 4 | Subject: [PATCH] PYTHON-4305 Fix bson size check (#1564) | ||
| 5 | |||
| 6 | CVE: CVE-2024-5629 | ||
| 7 | Upstream-Status: Backport [https://github.com/mongodb/mongo-python-driver/commit/372b5d68d5a57ccc43b33407cd23f0bc79d99283] | ||
| 8 | Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> | ||
| 9 | --- | ||
| 10 | bson/_cbsonmodule.c | 11 +++++------ | ||
| 11 | 1 file changed, 5 insertions(+), 6 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c | ||
| 14 | index 1a296db..73370e2 100644 | ||
| 15 | --- a/bson/_cbsonmodule.c | ||
| 16 | +++ b/bson/_cbsonmodule.c | ||
| 17 | @@ -2052,6 +2052,7 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer, | ||
| 18 | uint32_t c_w_s_size; | ||
| 19 | uint32_t code_size; | ||
| 20 | uint32_t scope_size; | ||
| 21 | + uint32_t len; | ||
| 22 | PyObject* code; | ||
| 23 | PyObject* scope; | ||
| 24 | PyObject* code_type; | ||
| 25 | @@ -2071,7 +2072,8 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer, | ||
| 26 | memcpy(&code_size, buffer + *position, 4); | ||
| 27 | code_size = BSON_UINT32_FROM_LE(code_size); | ||
| 28 | /* code_w_scope length + code length + code + scope length */ | ||
| 29 | - if (!code_size || max < code_size || max < 4 + 4 + code_size + 4) { | ||
| 30 | + len = 4 + 4 + code_size + 4; | ||
| 31 | + if (!code_size || max < code_size || max < len || len < code_size) { | ||
| 32 | goto invalid; | ||
| 33 | } | ||
| 34 | *position += 4; | ||
| 35 | @@ -2089,12 +2091,9 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer, | ||
| 36 | |||
| 37 | memcpy(&scope_size, buffer + *position, 4); | ||
| 38 | scope_size = BSON_UINT32_FROM_LE(scope_size); | ||
| 39 | - if (scope_size < BSON_MIN_SIZE) { | ||
| 40 | - Py_DECREF(code); | ||
| 41 | - goto invalid; | ||
| 42 | - } | ||
| 43 | /* code length + code + scope length + scope */ | ||
| 44 | - if ((4 + code_size + 4 + scope_size) != c_w_s_size) { | ||
| 45 | + len = 4 + 4 + code_size + scope_size; | ||
| 46 | + if (scope_size < BSON_MIN_SIZE || len != c_w_s_size || len < scope_size) { | ||
| 47 | Py_DECREF(code); | ||
| 48 | goto invalid; | ||
| 49 | } | ||
diff --git a/meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb b/meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb index d47dfec50f..e344b60e96 100644 --- a/meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb +++ b/meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb | |||
| @@ -8,6 +8,7 @@ HOMEPAGE = "http://github.com/mongodb/mongo-python-driver" | |||
| 8 | LICENSE = "Apache-2.0" | 8 | LICENSE = "Apache-2.0" |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" | 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" |
| 10 | 10 | ||
| 11 | SRC_URI += "file://CVE-2024-5629.patch" | ||
| 11 | SRC_URI[sha256sum] = "dbba77bc0b706c7ee496fc75a6c6ed406d85f6091d5fec488a8944c3828e6462" | 12 | SRC_URI[sha256sum] = "dbba77bc0b706c7ee496fc75a6c6ed406d85f6091d5fec488a8944c3828e6462" |
| 12 | 13 | ||
| 13 | inherit pypi setuptools3 | 14 | inherit pypi setuptools3 |
