sync some patches from community

This commit is contained in:
linwei9 2020-06-30 17:26:36 +08:00
parent 0146489fd1
commit 72fa3ce100
5 changed files with 195 additions and 5 deletions

View File

@ -0,0 +1,53 @@
From ad958385a4180d7a83d90589689fcd36e3bbc57a Mon Sep 17 00:00:00 2001
From: Nick Kew <niq@apache.org>
Date: Sun, 10 Sep 2017 22:30:14 +0000
Subject: [PATCH] Bounds-check human-readable date fields (credit: Stefan
Sperling)
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1807975 13f79535-47bb-0310-9956-ffa450edef68
---
time/unix/time.c | 3 +++
time/win32/time.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/time/unix/time.c b/time/unix/time.c
index dfa45e6..7f09581 100644
--- a/time/unix/time.c
+++ b/time/unix/time.c
@@ -142,6 +142,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt)
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
+ return APR_EBADDATE;
+
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)
diff --git a/time/win32/time.c b/time/win32/time.c
index 2349799..1a70544 100644
--- a/time/win32/time.c
+++ b/time/win32/time.c
@@ -54,6 +54,9 @@ static void SystemTimeToAprExpTime(apr_time_exp_t *xt, SYSTEMTIME *tm)
static const int dayoffset[12] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
+ if (tm->wMonth < 1 || tm->wMonth > 12)
+ return APR_EBADDATE;
+
/* Note; the caller is responsible for filling in detailed tm_usec,
* tm_gmtoff and tm_isdst data when applicable.
*/
@@ -224,6 +227,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t,
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
+ return APR_EBADDATE;
+
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)
--
1.8.3.1

View File

@ -0,0 +1,49 @@
From 9032d8c633dbc0f6fe2cd3358f767f088ffbf1ef Mon Sep 17 00:00:00 2001
From: Rainer Jung <rjung@apache.org>
Date: Wed, 17 Jul 2019 11:31:02 +0000
Subject: [PATCH] Follow up to r1675967 (trunk) resp. r1863202 (1.7.x): When
pool debugging is enabled, make sure we don't try to emit any debug events
after the debug log file handle has been closed.
Backport of r1675970 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1863203 13f79535-47bb-0310-9956-ffa450edef68
---
memory/unix/apr_pools.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 9fdd001..eb173c8 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -636,6 +636,12 @@ static apr_allocator_t *global_allocator = NULL;
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
static apr_file_t *file_stderr = NULL;
+static apr_status_t apr_pool_cleanup_file_stderr(void *data)
+{
+ file_stderr = NULL;
+ return APR_SUCCESS;
+}
+
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
/*
@@ -1706,6 +1712,13 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void)
file_stderr = debug_log;
if (file_stderr) {
+ /* Add a cleanup handler that sets the debug log file handle
+ * to NULL, otherwise we'll try to log the global pool
+ * destruction event with predictably disastrous results. */
+ apr_pool_cleanup_register(global_pool, NULL,
+ apr_pool_cleanup_file_stderr,
+ apr_pool_cleanup_null);
+
apr_file_printf(file_stderr,
"POOL DEBUG: [PID"
#if APR_HAS_THREADS
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From dfce87282409fcb9ca012bcc2db0061183bf91c8 Mon Sep 17 00:00:00 2001
From: Rainer Jung <rjung@apache.org>
Date: Wed, 17 Jul 2019 11:32:12 +0000
Subject: [PATCH] Register the pool debug log cleanup handler after emitting
the global pool creation event. This ensures that the allocation event from
the cleanup registration written after the creation event.
Backport of r1675982 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1863204 13f79535-47bb-0310-9956-ffa450edef68
---
memory/unix/apr_pools.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index eb173c8..a59d9da 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -1712,13 +1712,6 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void)
file_stderr = debug_log;
if (file_stderr) {
- /* Add a cleanup handler that sets the debug log file handle
- * to NULL, otherwise we'll try to log the global pool
- * destruction event with predictably disastrous results. */
- apr_pool_cleanup_register(global_pool, NULL,
- apr_pool_cleanup_file_stderr,
- apr_pool_cleanup_null);
-
apr_file_printf(file_stderr,
"POOL DEBUG: [PID"
#if APR_HAS_THREADS
@@ -1728,6 +1721,13 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void)
"POOL \"TAG\" <__FILE__:__LINE__> (ALLOCS/TOTAL ALLOCS/CLEARS)\n");
apr_pool_log_event(global_pool, "GLOBAL", __FILE__ ":apr_pool_initialize", 0);
+
+ /* Add a cleanup handler that sets the debug log file handle
+ * to NULL, otherwise we'll try to log the global pool
+ * destruction event with predictably disastrous results. */
+ apr_pool_cleanup_register(global_pool, NULL,
+ apr_pool_cleanup_file_stderr,
+ apr_pool_cleanup_null);
}
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
--
1.8.3.1

View File

@ -2,7 +2,7 @@
Name: apr
Version: 1.7.0
Release: 1
Release: 2
Summary: Apache Portable Runtime.
License: ASL 2.0 and BSD with advertising and ISC and BSD
URL: http://apr.apache.org
@ -11,10 +11,12 @@ Source1: apr-wrapper.h
Patch0: apr-1.2.2-libdir.patch
Patch1: apr-1.2.7-pkgconf.patch
Patch6000: Split-apr_pool_check_integrity-into-two-parts.patch
Patch6001: Pool-debugging-fixes.patch
Patch6002: Fix-pool-debugging-output-so-that-creation-events-ar.patch
Patch2: Split-apr_pool_check_integrity-into-two-parts.patch
Patch3: Pool-debugging-fixes.patch
Patch4: Fix-pool-debugging-output-so-that-creation-events-ar.patch
Patch5: memory-unix-apr_pools.c-apr_pool_cleanup_register.patch
Patch6: Follow-up-to-r1675967-trunk-resp.-r1863202-1.7.x.patch
Patch7: Register-the-pool-debug-log-cleanup-handler-after-em.patch
BuildRequires: gcc autoconf libtool libuuid-devel python3 lksctp-tools-devel
@ -98,6 +100,9 @@ make check
%doc docs/incomplete_types docs/non_apr_programs
%changelog
* Mon Jun 29 2020 linwei<linwei54@huawei.com> - 1.7.0-2
- sync some patches from community
* Mon May 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.7.0-1
- update to 1.7.0-1

View File

@ -0,0 +1,33 @@
From 54bc039ca9781c75b51ad39a01ae79d30efd6f09 Mon Sep 17 00:00:00 2001
From: Rainer Jung <rjung@apache.org>
Date: Wed, 17 Jul 2019 11:15:08 +0000
Subject: [PATCH] * memory/unix/apr_pools.c (apr_pool_cleanup_register):
[APR_POOL_DEBUG]: Catch NULL arguments which would lead to strange
segfaults later.
Backport of r1082177 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1863198 13f79535-47bb-0310-9956-ffa450edef68
---
memory/unix/apr_pools.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 524e9ac..3361f7a 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -2484,6 +2484,10 @@ APR_DECLARE(void) apr_pool_cleanup_register(apr_pool_t *p, const void *data,
#if APR_POOL_DEBUG
apr_pool_check_integrity(p);
+
+ if (!p || !plain_cleanup_fn || !child_cleanup_fn) {
+ abort();
+ }
#endif /* APR_POOL_DEBUG */
if (p != NULL) {
--
1.8.3.1