Skip to contentSkip to conversation

package/freeswitch: switch to pcre2

PATCH New Bernd Kuhls 1 participant 1 message Apr 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/freeswitch: switch to pcre2

Added patch 0006 which replaces the usage of pcre in favour of pcre2, this is a rebased version of upstream commits used by OpenWRT:
https://github.com/openwrt/telephony/commit/75acd1cdc29740a47454212cd48755b9abbd7a12

Added patch 0005 which is a prerequisite for patch 0006, also used by OpenWRT.

Added patch 0007 which fixes a runtime crash caused by patch 0006.

Added Upstream: tag to patch 0001.

---
 .checkpackageignore                           |    1 -
 ...-hash-hmac_ossl.c-fix-build-with-lib.patch |    2 +
 ...mory-leak-by-correctly-freeing-regex.patch |   34 +
 .../0006-Move-project-to-PCRE2.patch          | 1813 +++++++++++++++++
 ...x-double-free-after-upgrade-to-pcre2.patch |   27 +
 package/freeswitch/Config.in                  |    2 +-
 package/freeswitch/freeswitch.mk              |    5 +-
 7 files changed, 1881 insertions(+), 3 deletions(-)
 create mode 100644 package/freeswitch/0005-Fix-memory-leak-by-correctly-freeing-regex.patch
 create mode 100644 package/freeswitch/0006-Move-project-to-PCRE2.patch
 create mode 100644 package/freeswitch/0007-Fix-double-free-after-upgrade-to-pcre2.patch
.checkpackageignore +0 -1
index 6599435b62..1eca2febe9 100644
@@ -354,7 +354,6 @@ package/freescale-imx/imx-uuc/S80imx-uuc Shellcheck lib_sysv.Indent lib_sysv.Var
 package/freescale-imx/imx-vpu-hantro/0001-Fix-ion.h-header-inclusion-to-be-standard.patch lib_patch.Upstream
 package/freescale-imx/imx-vpu-hantro/0002-Fix-build-with-uclibc-toolchain.patch lib_patch.Upstream
 package/freescale-imx/imx-vpu-hantro/0003-Fix-Linux-kernel-version-header.patch lib_patch.Upstream
-package/freeswitch/0001-libs-srtp-crypto-hash-hmac_ossl.c-fix-build-with-lib.patch lib_patch.Upstream
 package/frr/S50frr Shellcheck
 package/fstrcmp/0001-disable-rpath.patch lib_patch.Upstream
 package/ftop/0001-overflow.patch lib_patch.Upstream
package/freeswitch/0001-libs-srtp-crypto-hash-hmac_ossl.c-fix-build-with-lib.patch +2 -0
index eb717fc26d..1a66e7c8d5 100644
@@ -25,6 +25,8 @@ crypto/hash/hmac_ossl.c:133:40: error: invalid application of 'sizeof' to incomp
 Fixes:
  - http://autobuild.buildroot.org/results/e696ead9ffffa5bb80928d75607bfbb9b263d3c6
 
+Upstream: https://github.com/signalwire/freeswitch/pull/1654
+
 Signed-off-by: Fabrice Fontaine <[email protected]>
 ---
  libs/srtp/crypto/hash/hmac_ossl.c | 6 ++++--
package/freeswitch/0005-Fix-memory-leak-by-correctly-freeing-regex.patch new file +34 -0
new file mode 100644
index 0000000000..5ce3a060a8
@@ -0,0 +1,34 @@
+From 12b47fe7f91b93ba9cec90676e62c6239a097c98 Mon Sep 17 00:00:00 2001
+From: Christian Marangi <[email protected]>
+Date: Fri, 3 Nov 2023 17:27:06 +0100
+Subject: [PATCH] [mod_verto] Fix memory leak by correctly freeing regex
+
+For mod_verto regex was never freed and was actually leaking memory.
+Correctly free the compiled regex to fix the memory leak.
+
+Signed-off-by: Christian Marangi <[email protected]>
+
+Upstream: https://github.com/signalwire/freeswitch/commit/12b47fe7f91b93ba9cec90676e62c6239a097c98
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ src/mod/endpoints/mod_verto/mod_verto.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c
+index 48c40527b56..36aba6db5e2 100644
+--- a/src/mod/endpoints/mod_verto/mod_verto.c
++++ b/src/mod/endpoints/mod_verto/mod_verto.c
+@@ -1893,10 +1893,12 @@ static void http_run(jsock_t *jsock)
+ 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ 								  "%d request [%s] matched expr [%s]\n", proceed, request->uri, expression);
+ 				request->uri = rule->value;
++				switch_regex_safe_free(re);
+ 				break;
+ 			}
+ 
+ 			rule = rule->next;
++			switch_regex_safe_free(re);
+ 		}
+ 	}
+ 
package/freeswitch/0006-Move-project-to-PCRE2.patch new file +1813 -0

1,813 lines not on this page · raw message

package/freeswitch/0007-Fix-double-free-after-upgrade-to-pcre2.patch new file +27 -0
new file mode 100644
index 0000000000..37455d7794
@@ -0,0 +1,27 @@
+From 02549c10d9155d0f71f36289aeeddc9c73a4d46e Mon Sep 17 00:00:00 2001
+From: Andrey Volk <[email protected]>
+Date: Thu, 13 Nov 2025 17:42:04 +0300
+Subject: [PATCH] [mod_dialplan_xml] Fix double free after upgrade to pcre2.
+ (#2946)
+
+Upstream: https://github.com/signalwire/freeswitch/commit/02549c10d9155d0f71f36289aeeddc9c73a4d46e
+
+[backported only second part of upstream commit, the first part is
+ already included in patch 0006]
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
+index 3d3fdfd8a93..cab522887c4 100644
+--- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
++++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
+@@ -357,6 +357,7 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
+ 					save_proceed = proceed;
+ 
+ 					re = NULL;
++					match_data = NULL;
+ 				}
+ 
+ 				switch_regex_and_match_data_safe_free(re, match_data);
package/freeswitch/Config.in +1 -1
index 3633a29903..ad54efc0cb 100644
@@ -10,7 +10,7 @@ config BR2_PACKAGE_FREESWITCH
 	select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC
 	select BR2_PACKAGE_JPEG
 	select BR2_PACKAGE_OPENSSL
-	select BR2_PACKAGE_PCRE
+	select BR2_PACKAGE_PCRE2
 	select BR2_PACKAGE_SOFIA_SIP
 	select BR2_PACKAGE_SPANDSP
 	select BR2_PACKAGE_SPEEX
package/freeswitch/freeswitch.mk +4 -1
index 1121bfa9cc..5cd80cfc4f 100644
@@ -19,6 +19,9 @@ FREESWITCH_LICENSE_FILES = \
 	libs/apr/LICENSE \
 	libs/srtp/LICENSE
 
+# 0006-Move-project-to-PCRE2.patch
+FREESWITCH_AUTORECONF = YES
+
 FREESWITCH_CPE_ID_VENDOR = freeswitch
 
 # required dependencies
@@ -27,7 +30,7 @@ FREESWITCH_DEPENDENCIES = \
 	jpeg \
 	libcurl \
 	openssl \
-	pcre \
+	pcre2 \
 	spandsp \
 	sofia-sip \
 	speex \
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot