summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/apr/apr/0001-dso-Check-for-NULL-handle-in-apr_dso_sym.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/apr/apr/0001-dso-Check-for-NULL-handle-in-apr_dso_sym.patch')
-rw-r--r--meta/recipes-support/apr/apr/0001-dso-Check-for-NULL-handle-in-apr_dso_sym.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-support/apr/apr/0001-dso-Check-for-NULL-handle-in-apr_dso_sym.patch b/meta/recipes-support/apr/apr/0001-dso-Check-for-NULL-handle-in-apr_dso_sym.patch
new file mode 100644
index 0000000000..8ba181b887
--- /dev/null
+++ b/meta/recipes-support/apr/apr/0001-dso-Check-for-NULL-handle-in-apr_dso_sym.patch
@@ -0,0 +1,37 @@
1From a25be1aaa92a6d2e7f4cc3fdfbb92e5a10b63035 Mon Sep 17 00:00:00 2001
2From: Greg Beard <gmbeard@googlemail.com>
3Date: Sat, 25 Mar 2023 08:31:36 +0000
4Subject: [PATCH] dso: Check for NULL handle in apr_dso_sym
5
6Upstream-Status: Backport [https://github.com/apache/apr/pull/40/commits/0efce00093b1ba405d91c7f0eab9755c8527eead]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 dso/unix/dso.c | 12 ++++++++++++
10 1 file changed, 12 insertions(+)
11
12diff --git a/dso/unix/dso.c b/dso/unix/dso.c
13index fdd56f1..583d5de 100644
14--- a/dso/unix/dso.c
15+++ b/dso/unix/dso.c
16@@ -173,6 +173,18 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
17 apr_dso_handle_t *handle,
18 const char *symname)
19 {
20+ /* This is necessary for `testdso.c`. For some reason, musl
21+ * builds fail the `test_unload_library` test if the below
22+ * check isn't in place. `test_unload_library` unloads the
23+ * library and then immediately calls this function. Maybe
24+ * musl's `dlsym()` assumes the handle is never NULL and
25+ * some UB is being invoked here...
26+ */
27+ if (handle->handle == NULL) {
28+ handle->errormsg = "library not loaded";
29+ return APR_ESYMNOTFOUND;
30+ }
31+
32 #if defined(DSO_USE_SHL)
33 void *symaddr = NULL;
34 int status;
35--
362.42.0
37