This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 1.3.x
in repository https://gitbox.apache.org/repos/asf/tomcat-native.git
The following commit(s) were added to refs/heads/1.3.x by this push:
new bd5850f46 Harden against the mis-use of Pool.destroy(long)
bd5850f46 is described below
commit bd5850f4683e0406cdae401f47eae895bc88dd2b
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Aug 28 18:57:28 2026 +0100
Harden against the mis-use of Pool.destroy(long)
---
native/src/pool.c | 11 ++++++++++-
xdocs/miscellaneous/changelog.xml | 3 +++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/native/src/pool.c b/native/src/pool.c
index 0fdc26174..230f3e7db 100644
--- a/native/src/pool.c
+++ b/native/src/pool.c
@@ -62,7 +62,16 @@ TCN_IMPLEMENT_CALL(void, Pool, destroy)(TCN_STDARGS, jlong
pool)
{
apr_pool_t *p = J2P(pool, apr_pool_t *);
UNREFERENCED_STDARGS;
- TCN_ASSERT(pool != 0);
+
+ if (pool == 0) {
+ jclass npe = (*e)->FindClass(e, "java/lang/NullPointerException");
+ if (npe != NULL) {
+ (*e)->ThrowNew(e, npe, "Pool must not be zero");
+ (*e)->DeleteLocalRef(e, npe);
+ }
+ return;
+ }
+
if (tcn_global_pool)
apr_pool_destroy(p);
}
diff --git a/xdocs/miscellaneous/changelog.xml
b/xdocs/miscellaneous/changelog.xml
index 50c523261..5c56e139f 100644
--- a/xdocs/miscellaneous/changelog.xml
+++ b/xdocs/miscellaneous/changelog.xml
@@ -82,6 +82,9 @@
Harden against the mis-use of <code>Buffer.address(ByteBuffer)</code>.
(markt)
</fix>
+ <fix>
+ Harden against the mis-use of <code>Pool.destroy(long)</code>. (markt)
+ </fix>
</changelog>
</section>
<section name="1.3.8" rtext="2026-06-15">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]