From 84f353a9fba3906f89012becd08c7f42b005a902 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 15 Nov 2024 09:42:13 +0100 Subject: fix memory leaks, initialize memory (from EL-10) --- onig-6.9.9-fix-memleaks-initialize-memory.patch | 38 +++++++++++++++++++++++++ oniguruma.spec | 15 +++++++--- 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 onig-6.9.9-fix-memleaks-initialize-memory.patch diff --git a/onig-6.9.9-fix-memleaks-initialize-memory.patch b/onig-6.9.9-fix-memleaks-initialize-memory.patch new file mode 100644 index 0000000..7c7fb16 --- /dev/null +++ b/onig-6.9.9-fix-memleaks-initialize-memory.patch @@ -0,0 +1,38 @@ +diff -up onig-6.9.9/src/regexec.c.orig onig-6.9.9/src/regexec.c +--- onig-6.9.9/src/regexec.c.orig 2022-12-12 14:27:04.000000000 +0100 ++++ onig-6.9.9/src/regexec.c 2024-07-29 12:30:55.752328341 +0200 +@@ -4517,6 +4517,7 @@ regset_search_body_position_lead(OnigReg + + sr = (SearchRange* )xmalloc(sizeof(*sr) * n); + CHECK_NULL_RETURN_MEMERR(sr); ++ xmemset(sr, 0, sizeof(*sr) * n); + + for (i = 0; i < n; i++) { + reg = set->rs[i].reg; +diff -up onig-6.9.9/src/regparse.c.orig onig-6.9.9/src/regparse.c +--- onig-6.9.9/src/regparse.c.orig 2024-07-29 12:31:07.838347726 +0200 ++++ onig-6.9.9/src/regparse.c 2024-07-29 12:33:48.509582274 +0200 +@@ -4190,7 +4190,10 @@ and_cclass(CClassNode* dest, CClassNode* + pbuf = tbuf; + } + } +- if (r != 0) return r; ++ if (r != 0) { ++ bbuf_free(pbuf); ++ return r; ++ } + + dest->mbuf = pbuf; + bbuf_free(buf1); +@@ -4247,7 +4250,10 @@ or_cclass(CClassNode* dest, CClassNode* + pbuf = tbuf; + } + } +- if (r != 0) return r; ++ if (r != 0) { ++ bbuf_free(pbuf); ++ return r; ++ } + + dest->mbuf = pbuf; + bbuf_free(buf1); diff --git a/oniguruma.spec b/oniguruma.spec index 5ea3411..f08c899 100644 --- a/oniguruma.spec +++ b/oniguruma.spec @@ -28,9 +28,10 @@ # Fedora 34 have 6.9.7, soname 5.1 # Fedora 34 have 6.9.6, soname 5.1 # Fedora 35 have 6.9.5, soname 5.0 -# RHEL-9 have 6.9.6, soname 5.1 -# RHEL-8 have 6.8.2, soname 5.0 -# EPEL-7 have 6.8.2, soname 5.0 +# RHEL-10 have 6.9.9, soname 5.4 +# RHEL-9 have 6.9.6, soname 5.1 +# RHEL-8 have 6.8.2, soname 5.0 +# EPEL-7 have 6.8.2, soname 5.0 %global mainver 6.9.9 #global postver 1 @@ -41,7 +42,7 @@ Name: %{libname}%{oldsoname}php Name: %{libname} %endif Version: %{mainver}%{?postver:.%postver} -Release: 1%{?dist} +Release: 2%{?dist} Summary: Regular expressions library # SPDX confirmed @@ -51,6 +52,8 @@ Source0: https://github.com/kkos/oniguruma/releases/download/v%{mainver}%{?postv # Bump soname from 5 to 105 to allow parallel installation Patch0: onig-soname.patch +# Fix memleaks +Patch1: onig-6.9.9-fix-memleaks-initialize-memory.patch BuildRequires: gcc @@ -90,6 +93,7 @@ grep ^LTVERSION= configure %if %{with rename} %patch -P0 -p1 -b .bump %endif +%patch -P1 -p1 -b .leaks %build @@ -163,6 +167,9 @@ sed -e '/^test_regset_LDADD/s/$/ -lrt/' -i test/Makefile %changelog +* Fri Nov 15 2024 Remi Collet -6.9.9-2 +- fix memory leaks, initialize memory (from EL-10) + * Tue Oct 17 2023 Remi Collet -6.9.9-1 - update to 6.9.9 -- cgit