Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
6663888889
!18 [sync] PR-16: Fix CVE-2022-25147
From: @openeuler-sync-bot 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
2023-02-14 06:57:31 +00:00
fly_fzc
863ff56523 Fix CVE-2022-25147
(cherry picked from commit 9d70f87e1349697d5f9e2051b64f3a5352fb6d21)
2023-02-14 14:26:57 +08:00
openeuler-ci-bot
395b1e20a0
!11 添加sw架构
From: @wuzx065891 
Reviewed-by: @lvying6 
Signed-off-by: @lvying6
2022-11-24 11:25:58 +00:00
wzx
4c48b7dc4d Add sw64 architecture
Signed-off-by: wzx <wuzx1226@qq.com>
2022-11-24 15:21:04 +08:00
openeuler-ci-bot
316fd09853 !8 replace libdb with gdbm and add requires gdbm-devel
From: @panxh_purple
Reviewed-by: @overweight
Signed-off-by: @overweight
2021-06-22 07:04:47 +00:00
panxiaohe
aab69dd72e replace libdb with gdbm and add requires gdbm-devel 2021-06-19 15:56:14 +08:00
openeuler-ci-bot
b9d222c814 !4 【轻量级 PR】:修改yaml错误
Merge pull request !4 from Shinwell_Hu/N/A
2020-07-13 19:01:46 +08:00
Shinwell_Hu
ede6d55ccf 修改yaml错误 2020-06-29 17:02:57 +08:00
openeuler-ci-bot
4e8ff73fe7 !3 add yaml file for apr-util
Merge pull request !3 from xu_ping/master
2020-06-19 16:05:56 +08:00
cherry530
3d2c2bdade add yaml file 2020-06-18 16:14:47 +08:00
4 changed files with 209 additions and 6 deletions

View File

@ -0,0 +1,28 @@
From a84e910ee8c0991ee23da668f9e849da3b03ebed Mon Sep 17 00:00:00 2001
From: wzx <wuzx1226@qq.com>
Date: Thu, 24 Nov 2022 15:11:53 +0800
Subject: [PATCH] Add sw64 architecture
Add sw64 architecture in file crypto/crypt_blowfish.c according to alpha architecture to support sw64 architecture.
Signed-off-by: wzx <wuzx1226@qq.com>
---
crypto/crypt_blowfish.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/crypt_blowfish.c b/crypto/crypt_blowfish.c
index 3d306cf..c22b06b 100644
--- a/crypto/crypt_blowfish.c
+++ b/crypto/crypt_blowfish.c
@@ -56,7 +56,7 @@
#ifdef __i386__
#define BF_ASM 0
#define BF_SCALE 1
-#elif defined(__x86_64__) || defined(__alpha__) || defined(__hppa__)
+#elif defined(__x86_64__) || defined(__alpha__) || defined(__hppa__) || defined(__sw_64__)
#define BF_ASM 0
#define BF_SCALE 1
#else
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: apr-util Name: apr-util
Version: 1.6.1 Version: 1.6.1
Release: 11 Release: 14
Summary: apr-util provides a number of helpful abstractions on top of APR. Summary: apr-util provides a number of helpful abstractions on top of APR.
License: ASL 2.0 License: ASL 2.0
URL: http://apr.apache.org URL: http://apr.apache.org
@ -13,8 +13,10 @@ Patch6001: Merge-r1822315-from-trunk.patch
Patch6002: Fix-error-handling-in-gdbm.patch Patch6002: Fix-error-handling-in-gdbm.patch
Patch6003: Merge-r1834022-r1834023-r1834024-from-trunk.patch Patch6003: Merge-r1834022-r1834023-r1834024-from-trunk.patch
Patch6004: Remove-dereference-of-null-pointer.patch Patch6004: Remove-dereference-of-null-pointer.patch
Patch6005: apr-util-Add-sw64-architecture.patch
Patch6006: backport-CVE-2022-25147-apr_base64-Make-sure-encoding-decoding-lengths-fit-i.patch
BuildRequires: gcc autoconf apr-devel >= 1.6.0 libdb-devel expat-devel libuuid-devel BuildRequires: gcc autoconf apr-devel >= 1.6.0 gdbm-devel expat-devel libuuid-devel
BuildRequires: mariadb-connector-c-devel sqlite-devel >= 3.1.0 openldap-devel openssl-devel BuildRequires: mariadb-connector-c-devel sqlite-devel >= 3.1.0 openldap-devel openssl-devel
Requires: apr-util%{?_isa} = %{version}-%{release} Requires: apr-util%{?_isa} = %{version}-%{release}
@ -40,7 +42,7 @@ work around or take advantage of platform-specific deficiencies or features.
%package devel %package devel
Summary: The development kit of apr-util. Summary: The development kit of apr-util.
Requires: expat-devel%{?_isa} apr-util%{?_isa} = %{version}-%{release} Requires: expat-devel%{?_isa} apr-util%{?_isa} = %{version}-%{release}
Requires: libdb-devel%{?_isa} openldap-devel%{?_isa} apr-devel%{?_isa} pkgconfig Requires: gdbm-devel%{?_isa} openldap-devel%{?_isa} apr-devel%{?_isa} pkgconfig
%description devel %description devel
The development kit of apr-util. The development kit of apr-util.
@ -68,8 +70,8 @@ The ODBC DBD driver of apr-util.
autoheader && autoconf autoheader && autoconf
export ac_cv_ldap_set_rebind_proc_style=three export ac_cv_ldap_set_rebind_proc_style=three
%configure --with-apr=%{_prefix} --includedir=%{_includedir}/apr-%{apuver} \ %configure --with-apr=%{_prefix} --includedir=%{_includedir}/apr-%{apuver} \
--with-ldap=ldap_r --without-gdbm --with-sqlite3 --with-pgsql --with-mysql --with-odbc \ --with-ldap=ldap_r --with-gdbm --with-sqlite3 --with-pgsql --with-mysql --with-odbc \
--with-dbm=db5 --with-berkeley-db --without-sqlite2 --with-crypto --with-openssl --with-dbm=gdbm --without-berkeley-db --without-sqlite2 --with-crypto --with-openssl
%make_build %make_build
%install %install
@ -102,7 +104,7 @@ make test
%license LICENSE %license LICENSE
%{_libdir}/libaprutil-%{apuver}.so.* %{_libdir}/libaprutil-%{apuver}.so.*
%dir %{_libdir}/%{name}-%{apuver} %dir %{_libdir}/%{name}-%{apuver}
%{_libdir}/%{name}-%{apuver}/apr_dbm_db* %{_libdir}/%{name}-%{apuver}/apr_dbm_gdbm*
%{_libdir}/%{name}-%{apuver}/apr_dbd_mysql* %{_libdir}/%{name}-%{apuver}/apr_dbd_mysql*
%{_libdir}/%{name}-%{apuver}/apr_dbd_sqlite* %{_libdir}/%{name}-%{apuver}/apr_dbd_sqlite*
%{_libdir}/%{name}-%{apuver}/apr_ldap* %{_libdir}/%{name}-%{apuver}/apr_ldap*
@ -123,6 +125,16 @@ make test
%{_libdir}/%{name}-%{apuver}/apr_dbd_odbc* %{_libdir}/%{name}-%{apuver}/apr_dbd_odbc*
%changelog %changelog
* Tue Feb 14 2023 fuanan <fuanan3@h-partners.com> - 1.6.1-14
- Fix CVE-2022-25147
* Thu Jul 28 2022 wuzx<wuzx1226@qq.com> - 1.6.1-13
- add sw64 patch
* Sat Jun 19 2021 panxiaohe <panxiaohe@huawei.com> - 1.6.1-12
- BuildRequires: replace libdb with gdbm
- Add requires gdbm-devel
* Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.6.1-11 * Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.6.1-11
- Delete useless files. - Delete useless files.

4
apr-util.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: svn
src_repo: https://svn.apache.org/repos/asf/apr/apr-util
tag_prefix: ""
seperator: "."

View File

@ -0,0 +1,159 @@
From 850cc4f69639ac9f1c1c9767efaf4883ee3217ce Mon Sep 17 00:00:00 2001
From: Yann Ylavic <ylavic@apache.org>
Date: Thu, 23 Jun 2022 15:12:47 +0000
Subject: [PATCH] apr_base64: Make sure encoding/decoding lengths fit in an int
>= 0.
The (old) API of apr_base64 functions has always used int for representing
lengths and it does not return errors. Make sure to abort() if the provided
data don't fit.
* encoding/apr_base64.c():
#define APR_BASE64_ENCODE_MAX and APR_BASE64_DECODE_MAX as the hard length
limits for encoding and decoding respectively.
* encoding/apr_base64.c(apr_base64_encode_len, apr_base64_encode,
apr_base64_encode_binary, apr_pbase64_encode):
abort() if the given length is above APR_BASE64_ENCODE_MAX.
* encoding/apr_base64.c(apr_base64_decode_len, apr_base64_decode,
apr_base64_decode_binary, apr_pbase64_decode):
abort() if the given plain buffer length is above APR_BASE64_DECODE_MAX.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902206 13f79535-47bb-0310-9956-ffa450edef68
---
encoding/apr_base64.c | 46 ++++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/encoding/apr_base64.c b/encoding/apr_base64.c
index b4b28cf75..f5c2786ad 100644
--- a/encoding/apr_base64.c
+++ b/encoding/apr_base64.c
@@ -20,11 +20,20 @@
* ugly 'len' functions, which is quite a nasty cost.
*/
+#undef NDEBUG /* always abort() on assert()ion failure */
+#include <assert.h>
+
#include "apr_base64.h"
#if APR_CHARSET_EBCDIC
#include "apr_xlate.h"
#endif /* APR_CHARSET_EBCDIC */
+/* Above APR_BASE64_ENCODE_MAX length the encoding can't fit in an int >= 0 */
+#define APR_BASE64_ENCODE_MAX 1610612733
+
+/* Above APR_BASE64_DECODE_MAX length the decoding can't fit in an int >= 0 */
+#define APR_BASE64_DECODE_MAX 2863311524u
+
/* aaaack but it's fast and const should make it shared text page. */
static const unsigned char pr2six[256] =
{
@@ -109,24 +118,22 @@ APU_DECLARE(apr_status_t) apr_base64init_ebcdic(apr_xlate_t *to_ascii,
APU_DECLARE(int) apr_base64_decode_len(const char *bufcoded)
{
- int nbytesdecoded;
register const unsigned char *bufin;
register apr_size_t nprbytes;
bufin = (const unsigned char *) bufcoded;
while (pr2six[*(bufin++)] <= 63);
-
nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = (((int)nprbytes + 3) / 4) * 3;
+ assert(nprbytes <= APR_BASE64_DECODE_MAX);
- return nbytesdecoded + 1;
+ return (int)(((nprbytes + 3u) / 4u) * 3u + 1u);
}
APU_DECLARE(int) apr_base64_decode(char *bufplain, const char *bufcoded)
{
#if APR_CHARSET_EBCDIC
apr_size_t inbytes_left, outbytes_left;
-#endif /* APR_CHARSET_EBCDIC */
+#endif /* APR_CHARSET_EBCDIC */
int len;
len = apr_base64_decode_binary((unsigned char *) bufplain, bufcoded);
@@ -154,12 +161,13 @@ APU_DECLARE(int) apr_base64_decode_binary(unsigned char *bufplain,
bufin = (const unsigned char *) bufcoded;
while (pr2six[*(bufin++)] <= 63);
nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
- nbytesdecoded = (((int)nprbytes + 3) / 4) * 3;
+ assert(nprbytes <= APR_BASE64_DECODE_MAX);
+ nbytesdecoded = (int)(((nprbytes + 3u) / 4u) * 3u);
bufout = (unsigned char *) bufplain;
bufin = (const unsigned char *) bufcoded;
- while (nprbytes > 4) {
+ while (nprbytes >= 4) {
*(bufout++) =
(unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
*(bufout++) =
@@ -179,13 +187,8 @@ APU_DECLARE(int) apr_base64_decode_binary(unsigned char *bufplain,
*(bufout++) =
(unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
}
- if (nprbytes > 3) {
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
- }
- nbytesdecoded -= (4 - (int)nprbytes) & 3;
- return nbytesdecoded;
+ return nbytesdecoded - (int)((4u - nprbytes) & 3u);
}
static const char basis_64[] =
@@ -203,6 +206,8 @@ static const char basis_64[] =
APU_DECLARE(int) apr_base64_encode_len(int len)
{
+ assert(len >= 0 && len <= APR_BASE64_ENCODE_MAX);
+
return ((len + 2) / 3 * 4) + 1;
}
@@ -214,6 +219,8 @@ APU_DECLARE(int) apr_base64_encode(char *encoded, const char *string, int len)
int i;
char *p;
+ assert(len >= 0 && len <= APR_BASE64_ENCODE_MAX);
+
p = encoded;
for (i = 0; i < len - 2; i += 3) {
*p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
@@ -238,7 +245,7 @@ APU_DECLARE(int) apr_base64_encode(char *encoded, const char *string, int len)
}
*p++ = '\0';
- return p - encoded;
+ return (unsigned int)(p - encoded);
#endif /* APR_CHARSET_EBCDIC */
}
@@ -251,6 +258,8 @@ APU_DECLARE(int) apr_base64_encode_binary(char *encoded,
int i;
char *p;
+ assert(len >= 0 && len <= APR_BASE64_ENCODE_MAX);
+
p = encoded;
for (i = 0; i < len - 2; i += 3) {
*p++ = basis_64[(string[i] >> 2) & 0x3F];
@@ -275,5 +284,5 @@ APU_DECLARE(int) apr_base64_encode_binary(char *encoded,
}
*p++ = '\0';
- return (int)(p - encoded);
+ return (unsigned int)(p - encoded);
}
--
2.27.0