summaryrefslogtreecommitdiffstats
path: root/upstream.patch
blob: be72054a4567b551c7587b9507a1e8d240f679ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 3d90a24e9349ea17e5467de7b1d7bfa17ec2c650 Mon Sep 17 00:00:00 2001
From: Jakub Zelenka <bukka@php.net>
Date: Thu, 24 Nov 2022 18:29:44 +0000
Subject: [PATCH] Fix GH-9997: OpenSSL engine clean up segfault

---
 NEWS                  | 3 +++
 ext/openssl/openssl.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index cb5e6260b4ab..da555c843c15 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1324,13 +1324,14 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
 	EVP_cleanup();
 
+	/* prevent accessing locking callback from unloaded extension */
+	CRYPTO_set_locking_callback(NULL);
+
 #ifndef OPENSSL_NO_ENGINE
 	/* Free engine list initialized by OPENSSL_config */
 	ENGINE_cleanup();
 #endif
 
-	/* prevent accessing locking callback from unloaded extension */
-	CRYPTO_set_locking_callback(NULL);
 	/* free allocated error strings */
 	ERR_free_strings();
 	CONF_modules_free();