commit:     8b177cea39a5f4c6b96b698fb29266678ee19e0b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 16 12:07:39 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Feb 16 12:07:39 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b177cea

mail-mta/exim-4.97.1-r4: update regex memory patch

Include 44b3172e3694 from upstream.

Bug: https://bugs.gentoo.org/922780
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../{exim-4.97.1-r4.ebuild => exim-4.97.1-r5.ebuild}   |  0
 .../exim/files/exim-4.97.1-memory-usage-bug-3047.patch | 18 ++++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/mail-mta/exim/exim-4.97.1-r4.ebuild 
b/mail-mta/exim/exim-4.97.1-r5.ebuild
similarity index 100%
rename from mail-mta/exim/exim-4.97.1-r4.ebuild
rename to mail-mta/exim/exim-4.97.1-r5.ebuild

diff --git a/mail-mta/exim/files/exim-4.97.1-memory-usage-bug-3047.patch 
b/mail-mta/exim/files/exim-4.97.1-memory-usage-bug-3047.patch
index e467edf71fa2..c9b52f2aebfe 100644
--- a/mail-mta/exim/files/exim-4.97.1-memory-usage-bug-3047.patch
+++ b/mail-mta/exim/files/exim-4.97.1-memory-usage-bug-3047.patch
@@ -26,6 +26,11 @@ Date: Tue, 13 Feb 2024 17:34:19 +0000
 Subject: [PATCH] Use non-releasable memory for regex line-buffer
 Broken-by: 5aacb69f5c8
 
+From 44b3172e369435c2c1baa4e9c837252f729d2905 Mon Sep 17 00:00:00 2001
+From: Jeremy Harris <[email protected]>
+Date: Thu, 15 Feb 2024 19:56:40 +0000
+Subject: [PATCH] regex: avoid releasing built RE midloop
+
 diff --git a/src/src/exim.c b/src/src/exim.c
 --- a/src/exim.c
 +++ b/src/exim.c
@@ -176,7 +181,7 @@ diff --git a/src/src/regex.c b/src/src/regex.c
      return OK;
      }
    }
-@@ -110,9 +111,9 @@ FILE * mbox_file;
+@@ -110,9 +111,8 @@ FILE * mbox_file;
  unsigned long mbox_size;
  FILE * mbox_file;
  pcre_list * re_list_head;
@@ -184,7 +189,6 @@ diff --git a/src/src/regex.c b/src/src/regex.c
  long f_pos = 0;
 -int ret = FAIL;
 +int ret = FAIL, cnt, lcount = REGEX_LOOPCOUNT_STORE_RESET;
-+rmark reset_point;
  
  regex_vars_clear();
  
@@ -199,8 +203,7 @@ diff --git a/src/src/regex.c b/src/src/regex.c
 -/* match each line against all regexes */
 -linebuffer = store_get(32767, GET_TAINTED);
 -while (fgets(CS linebuffer, 32767, mbox_file))
-+reset_point = store_mark();
-   {
+-  {
 -  if (  mime_stream && mime_current_boundary          /* check boundary */
 -     && Ustrncmp(linebuffer, "--", 2) == 0
 -     && Ustrncmp((linebuffer+2), mime_current_boundary,
@@ -212,6 +215,8 @@ diff --git a/src/src/regex.c b/src/src/regex.c
 +  /* precompile our regexes */
 +  if ((re_list_head = compile(*listptr, cacheable, &cnt)))
 +    {
++    rmark reset_point = store_mark();
++
 +    while (fgets(CS big_buffer, big_buffer_size, mbox_file))
 +      {
 +      if (  mime_stream && mime_current_boundary              /* check 
boundary */
@@ -229,10 +234,11 @@ diff --git a/src/src/regex.c b/src/src/regex.c
 +      lcount = REGEX_LOOPCOUNT_STORE_RESET;
 +      }
 +      }
++
++    store_reset(reset_point);
 +    }
-   }
+-  }
 -/* no matches ... */
-+store_reset(reset_point);
  
 -done:
  if (!mime_stream)

Reply via email to