public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-mta/exim/files/, mail-mta/exim/
Date: Thu, 15 Feb 2024 08:28:32 +0000 (UTC)	[thread overview]
Message-ID: <1707985707.fa7a1f384983f4d7158e7edbd9cab1a914140d28.grobian@gentoo> (raw)

commit:     fa7a1f384983f4d7158e7edbd9cab1a914140d28
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 15 08:27:25 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Feb 15 08:28:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fa7a1f38

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

Include 6fcb3173d6 and 5aacb69f5c8 from upstream.

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

 ...exim-4.97.1-r3.ebuild => exim-4.97.1-r4.ebuild} |  0
 .../files/exim-4.97.1-memory-usage-bug-3047.patch  | 49 ++++++++++++++++------
 2 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/mail-mta/exim/exim-4.97.1-r3.ebuild b/mail-mta/exim/exim-4.97.1-r4.ebuild
similarity index 100%
rename from mail-mta/exim/exim-4.97.1-r3.ebuild
rename to mail-mta/exim/exim-4.97.1-r4.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 b8f4eb9c5eef..e467edf71fa2 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
@@ -15,6 +15,16 @@ Date: Sun, 11 Feb 2024 13:57:18 +0000 (+0000)
 Subject: Use non-releaseable memory for regex match strings. Bug 3047
 Broken-by: 35aacb69f5c8
 
+From 6fcb3173d64ef8a9d70f8adf19f134a0cd9cf6e8 Mon Sep 17 00:00:00 2001
+From: Jeremy Harris <jgh146exb@wizmail.org>
+Date: Sun, 11 Feb 2024 15:04:58 +0000
+Subject: [PATCH] use dynamic mem for regex_match_string
+
+From a173a4376d168edbf3fe2494dff998c4060bf425 Mon Sep 17 00:00:00 2001
+From: Jeremy Harris <jgh146exb@wizmail.org>
+Date: Tue, 13 Feb 2024 17:34:19 +0000
+Subject: [PATCH] Use non-releasable memory for regex line-buffer
+Broken-by: 5aacb69f5c8
 
 diff --git a/src/src/exim.c b/src/src/exim.c
 --- a/src/exim.c
@@ -99,6 +109,15 @@ diff --git a/src/src/macros.h b/src/src/macros.h
 diff --git a/src/src/regex.c b/src/src/regex.c
 --- a/src/regex.c
 +++ b/src/regex.c
+@@ -24,8 +24,6 @@ typedef struct pcre_list {
+   struct pcre_list *	next;
+ } pcre_list;
+ 
+-uschar regex_match_string_buffer[1024];
+-
+ extern FILE *mime_stream;
+ extern uschar *mime_current_boundary;
+ 
 @@ -31,12 +31,11 @@ extern uschar *mime_current_boundary;
  
  
@@ -135,16 +154,20 @@ diff --git a/src/src/regex.c b/src/src/regex.c
  static int
  matcher(pcre_list * re_list_head, uschar * linebuffer, int len)
  {
-@@ -75,6 +82,9 @@ for (pcre_list * ri = re_list_head; ri; ri = ri->next)
+@@ -75,9 +82,10 @@ for (pcre_list * ri = re_list_head; ri; ri = ri->next)
    /* try matcher on the line */
    if ((n = pcre2_match(ri->re, (PCRE2_SPTR)linebuffer, len, 0, 0, md, pcre_gen_mtc_ctx)) > 0)
      {
 +    int save_pool = store_pool;
 +    store_pool = POOL_PERM;
 +
-     Ustrncpy(regex_match_string_buffer, ri->pcre_text,
- 	      sizeof(regex_match_string_buffer)-1);
-     regex_match_string = regex_match_string_buffer;
+-    Ustrncpy(regex_match_string_buffer, ri->pcre_text,
+-	      sizeof(regex_match_string_buffer)-1);
+-    regex_match_string = regex_match_string_buffer;
++    regex_match_string = string_copy(ri->pcre_text);
+ 
+     for (int nn = 1; nn < n; nn++)
+       {
 @@ -87,6 +97,7 @@ for (pcre_list * ri = re_list_head; ri; ri = ri->next)
        regex_vars[nn-1] = string_copyn(linebuffer + ovec[off], len);
        }
@@ -153,9 +176,11 @@ diff --git a/src/src/regex.c b/src/src/regex.c
      return OK;
      }
    }
-@@ -112,7 +113,8 @@ FILE * mbox_file;
+@@ -110,9 +111,9 @@ FILE * mbox_file;
+ unsigned long mbox_size;
+ FILE * mbox_file;
  pcre_list * re_list_head;
- uschar * linebuffer;
+-uschar * linebuffer;
  long f_pos = 0;
 -int ret = FAIL;
 +int ret = FAIL, cnt, lcount = REGEX_LOOPCOUNT_STORE_RESET;
@@ -163,7 +188,7 @@ diff --git a/src/src/regex.c b/src/src/regex.c
  
  regex_vars_clear();
  
-@@ -136,26 +138,34 @@ else
+@@ -136,26 +138,32 @@ else
    mbox_file = mime_stream;
    }
  
@@ -187,17 +212,15 @@ diff --git a/src/src/regex.c b/src/src/regex.c
 +  /* precompile our regexes */
 +  if ((re_list_head = compile(*listptr, cacheable, &cnt)))
 +    {
-+    /* match each line against all regexes */
-+    linebuffer = store_get(32767, GET_TAINTED);
-+    while (fgets(CS linebuffer, 32767, mbox_file))
++    while (fgets(CS big_buffer, big_buffer_size, mbox_file))
 +      {
 +      if (  mime_stream && mime_current_boundary		/* check boundary */
-+	 && Ustrncmp(linebuffer, "--", 2) == 0
-+	 && Ustrncmp((linebuffer+2), mime_current_boundary,
++	 && Ustrncmp(big_buffer, "--", 2) == 0
++	 && Ustrncmp((big_buffer+2), mime_current_boundary,
 +		      Ustrlen(mime_current_boundary)) == 0)
 +	break;						/* found boundary */
 +
-+      if ((ret = matcher(re_list_head, linebuffer, (int)Ustrlen(linebuffer))) == OK)
++      if ((ret = matcher(re_list_head, big_buffer, (int)Ustrlen(big_buffer))) == OK)
 +	break;
 +
 +      if ((lcount -= cnt) <= 0)


             reply	other threads:[~2024-02-15  8:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15  8:28 Fabian Groffen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-26 19:08 [gentoo-commits] repo/gentoo:master commit in: mail-mta/exim/files/, mail-mta/exim/ Fabian Groffen
2023-11-07 20:47 Fabian Groffen
2023-05-27  8:55 Fabian Groffen
2022-12-27 20:33 Fabian Groffen
2022-10-19 12:52 Fabian Groffen
2022-10-19  7:53 Fabian Groffen
2021-09-29  6:32 Fabian Groffen
2021-07-01 16:08 Fabian Groffen
2021-05-08  8:23 Fabian Groffen
2021-05-05 18:43 Fabian Groffen
2020-06-01 17:58 Fabian Groffen
2020-05-24 11:27 Fabian Groffen
2020-05-13 17:20 Fabian Groffen
2019-12-09 17:18 Fabian Groffen
2019-06-28 13:50 Fabian Groffen
2017-11-29  8:50 Fabian Groffen
2017-11-26 13:40 Fabian Groffen
2017-02-12  7:51 Fabian Groffen
2017-01-30  7:46 Fabian Groffen
2016-09-25  8:56 Fabian Groffen
2016-07-20 11:13 Fabian Groffen
2016-02-03 13:50 Fabian Groffen
2015-08-25  4:21 Jeroen Roovers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1707985707.fa7a1f384983f4d7158e7edbd9cab1a914140d28.grobian@gentoo \
    --to=grobian@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox