Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
ef2afe0e52
!41 Fix CVE-2024-21506
From: @Venland 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2024-04-07 08:45:55 +00:00
liweigang
19ead444c9 Fix CVE-2024-21506
Signed-off-by: liweigang <liweiganga@uniontech.com>
2024-04-07 15:19:55 +08:00
openeuler-ci-bot
37fdefe6b9
!36 PYTHON-1918 Stop using BSON.encode and BSON.decode functions
From: @lb1107039128 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
2023-12-25 07:46:52 +00:00
lb1107039128
ae4c4a5117 PYTHON-1918 Stop using BSON.encode and BSON.decode functions
Signed-off-by: lb1107039128 <liubo1@xfusion.com>
2023-12-21 17:56:43 +08:00
openeuler-ci-bot
4c30ddd9a1 !6 Fix source0
From: @kkkl12
Reviewed-by: @yanzh_h
Signed-off-by: @yanzh_h
2020-09-18 14:29:55 +08:00
kkkl12
aafcb6ce20 Fix Source0 2020-09-17 17:46:59 +08:00
openeuler-ci-bot
83141cdd11 !3 add release version for rebuild
Merge pull request !3 from 桐小哥/openEuler-20.03-LTS
2020-08-21 14:23:06 +08:00
桐小哥
3f06874d11 add release version for rebuild 2020-08-21 11:38:00 +08:00
openeuler-ci-bot
fc71aabcfe !1 python-pymongo
Merge pull request !1 from syyhao/dev221
2020-02-21 18:27:00 +08:00
openeuler-basic
c34b28f06b Revise build requires of python2-sphinx to python3-sphinx 2020-02-21 18:11:55 +08:00
4 changed files with 1404 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
From 56b6b6dbc267d365d97c037082369dabf37405d2 Mon Sep 17 00:00:00 2001
From: Shane Harvey <shnhrv@gmail.com>
Date: Wed, 27 Mar 2024 16:51:23 -0700
Subject: [PATCH] PYTHON-4305 Fix bson size check (#1564)
(cherry picked from commit 372b5d68d5a57ccc43b33407cd23f0bc79d99283)
---
bson/_cbsonmodule.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c
index 4e1881a275..da86cd8133 100644
--- a/bson/_cbsonmodule.c
+++ b/bson/_cbsonmodule.c
@@ -2405,6 +2405,7 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
uint32_t c_w_s_size;
uint32_t code_size;
uint32_t scope_size;
+ uint32_t len;
PyObject* code;
PyObject* scope;
PyObject* code_type;
@@ -2424,7 +2425,8 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
memcpy(&code_size, buffer + *position, 4);
code_size = BSON_UINT32_FROM_LE(code_size);
/* code_w_scope length + code length + code + scope length */
- if (!code_size || max < code_size || max < 4 + 4 + code_size + 4) {
+ len = 4 + 4 + code_size + 4;
+ if (!code_size || max < code_size || max < len || len < code_size) {
goto invalid;
}
*position += 4;
@@ -2442,12 +2444,9 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
memcpy(&scope_size, buffer + *position, 4);
scope_size = BSON_UINT32_FROM_LE(scope_size);
- if (scope_size < BSON_MIN_SIZE) {
- Py_DECREF(code);
- goto invalid;
- }
/* code length + code + scope length + scope */
- if ((4 + code_size + 4 + scope_size) != c_w_s_size) {
+ len = 4 + 4 + code_size + scope_size;
+ if (scope_size < BSON_MIN_SIZE || len != c_w_s_size || len < scope_size) {
Py_DECREF(code);
goto invalid;
}

View File

@ -1,21 +1,25 @@
Name: python-pymongo
Version: 3.9.0
Release: 1
Release: 6
License: Apache License 2.0
Summary: PyMongo - the Python driver for MongoDB
URL: https://github.com/mongodb/mongo-python-driver
Source0: %{URL}/archive/mongo-python-driver-%{version}.tar.gz
Source0: https://github.com/mongodb/mongo-python-driver/archive/%{version}.tar.gz
Patch01: 0001-Use-ssl.match_hostname-from-the-Python-stdlib.patch
BuildRequires: python2-devel python3-devel
BuildRequires: python2-setuptools python3-setuptools
BuildRequires: python2-sphinx
BuildRequires: python3-sphinx
%global _description \
The PyMongo distribution contains tools for interacting with \
MongoDB database from Python.\
PyMongo supports MongoDB 2.6, 3.0, 3.2, 3.4, 3.6, 4.0 and 4.2.
Patch0002: 0001-PYTHON-1918-Stop-using-BSON.encode-and-BSON.decode-f.patch
# patch source: https://github.com/mongodb/mongo-python-driver/commit/56b6b6dbc267d365d97c037082369dabf37405d2
Patch0003: backport-CVE-2024-21506.patch
%description %{_description}
%package -n python2-bson
@ -156,5 +160,20 @@ popd
%{_pkgdocdir}
%changelog
* Sun Apr 07 2024 liweigang <liweiganga@uniontech.com> - 3.9.0-6
- Fix CVE-2024-21506
* Thu Dec 21 2023 liubo <liubo1@xfusion.com> - 3.9.0-5
- PYTHON-1918 Stop using BSON.encode and BSON.decode functions
* Thu Sep 17 2020 liuweibo <liuweibo10@huawei.com> - 3.9.0-4
- Fix Source0
* Fri Aug 21 2020 shixuantong <shixuantong@huawei.com> - 3.9.0-3
- add release version for rebuild
* Fri Feb 21 2020 shanshishi <shanshishi@huawei.com> - 3.9.0-2
- Revise build requires of python2-sphinx to python3-sphinx
* Sat Nov 2 2019 shanshishi <shanshishi@huawei.com> - 3.9.0-1
- Init package